how to put a txt file in a unit testing using c++ visual studio

help me.. does not work.. for example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  TEST_METHOD(test1)
    {
      // arrange
      string text, expected;
    
      ifstream infile("input.txt");
      ofstream outfile("output.txt");
      if (infile.is_open() && outfile.is_open())
      {
        while (getline(infile, text))
        {
          outfile << text;
          //cout<<text;
        }
        infile.close();
        outfile.close();
      }
      //act
      replacefunction(text);

   // assert
      Assert::AreEqual(expected, text);
    }
does not work

Wow. What an amazingly helpful description of your problem. I'm sure with details like that, we'll be able to solve it in no time!
Topic archived. No new replies allowed.