public void PersonPrintTest() { Person man = new Person("Alex"); using (StreamWriter sw = new StreamWriter("TestPrint.txt")) { man.Print(sw); } // string path = System.IO.Directory.GetCurrentDirectory().Replace("bin\\Debug", "TestPrint.txt"); string path = "TestPrint.txt"; string expected = man.ToString(); string actual; using (StreamReader sr = new StreamReader(path)) { actual = sr.ReadLine(); } Assert.AreEqual(actual, expected); }