コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: Jeners2000/Stock
        public void CController_SaveLoadStrings_TEST()
        {
            //Òåñò ïðàâèëüíîñòè ñîõðàíåíèÿ\çàãðóçêè ôàéëà
            List <string> TestStrings = new List <string>();

            TestStrings.Add("C1	2760	0	0	0	0");
            TestStrings.Add("C2	4350	370	120	950	560");
            TestController.StringsListToFile("Test.txt", TestStrings);
            Assert.AreEqual(File.Exists("Test.txt"), true);
            TestStrings.Clear();
            TestStrings = TestController.FileToStringsList("Test.txt");
            Assert.AreEqual(TestStrings[0], "C1	2760	0	0	0	0");
            Assert.AreEqual(TestStrings[1], "C2	4350	370	120	950	560");
            File.Delete("Test.txt");
            Assert.AreEqual(File.Exists("Test.txt"), false);
            string TestString = "C1	2760	0	0	0	0\nC2	4350	370	120	950	560";

            TestController.StringToFile("Test.txt", TestString);
            TestStrings.Clear();
            TestStrings = TestController.FileToStringsList("Test.txt");
            Assert.AreEqual(TestStrings[0], "C1	2760	0	0	0	0");
            Assert.AreEqual(TestStrings[1], "C2	4350	370	120	950	560");
            Assert.AreEqual(File.Exists("Test.txt"), true);
            File.Delete("Test.txt");
            Assert.AreEqual(File.Exists("Test.txt"), false);
        }