示例#1
0
        public void TestAnneeBisextile()
        {
            var inputs = new string[]
            {
                "2",
                "2019",
                "2020"
            };
            var console = new MyConsoleFake(inputs);

            new MyProgramAnneeBisextile().Run(console);
            int i = 0;
        }
示例#2
0
        public void TestChoco()
        {
            var folder     = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..", @"TestChoco"));
            var inputFiles = Directory.EnumerateFiles(folder, "input*.txt").ToList();
            var ouputFiles = Directory.EnumerateFiles(folder, "output*.txt").ToList();

            for (var i = 0; i < inputFiles.Count; i++)
            {
                var inputs  = File.ReadAllLines(inputFiles[i]);
                var console = new MyConsoleFake(inputs);
                new MyProgramChoco().Run(console);

                var outputs = File.ReadAllText(ouputFiles[i]);
                Assert.AreEqual(outputs, console.Output, $"input:{i}");
            }
        }
示例#3
0
        public void TestPowerPlant()
        {
            var folder     = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..", @"TestPowerPlant"));
            var inputFiles = Directory.EnumerateFiles(folder, "input*.txt").OrderBy(s => Int32.Parse(Path.GetFileNameWithoutExtension(s).Substring(5))).ToList();
            var ouputFiles = Directory.EnumerateFiles(folder, "output*.txt").OrderBy(s => Int32.Parse(Path.GetFileNameWithoutExtension(s).Substring(6))).ToList();

            for (var i = 0; i < inputFiles.Count; i++)
            {
                var inputs  = File.ReadAllLines(inputFiles[i]);
                var console = new MyConsoleFake(inputs);
                new MyProgramPowerPlant().Run(console);

                var outputs = File.ReadAllText(ouputFiles[i]);
                Assert.AreEqual(outputs, console.Output, $"input:{i+1}\nerror:\n{console.ErrorOutput}");
            }
        }