public void Test_Fruits_Deserialization_Method() { FruitsHelper.CreateFruitsTestData(); FruitsHelper.FruitsSerialization(); using (StringWriter writer = new StringWriter()) { Console.SetOut(writer); FruitsHelper.FruitsDeserialization(); string expected = "Fruit Apple and it's colour Red\r\n" + "Fruit Banana and it's colour Yellow\r\n" + "Fruit Pineapple and it's colour Yellow\r\n" + "Citrus Pomelo, it's color Green and the amount of vitamin C 2\r\n" + "Citrus Lemon, it's color Yellow and the amount of vitamin C 3\r\n" + "Citrus Mandarin, it's color Orange and the amount of vitamin C 1\r\n"; string actual = writer.ToString(); Assert.AreEqual(expected, actual); writer.Close(); } }
public void Test_Print_Yellow_Fruits_Method() { FruitsHelper.CreateFruitsTestData(); using (StringWriter writer = new StringWriter()) { Console.SetOut(writer); FruitsHelper.PrintYellowFruit(); string expected = "Fruit Banana and it's colour Yellow\r\n" + "Fruit Pineapple and it's colour Yellow\r\n" + "Citrus Lemon, it's color Yellow and the amount of vitamin C 3\r\n"; string actual = writer.ToString(); Assert.AreEqual(expected, actual); writer.Close(); } }