Exemple #1
0
        public void ShouldHaveProcessedWhenAllClothingAndLeaveOnHotDay()
        {
            string        inputCommands  = "8, 6, 4, 2, 1, 7";
            List <string> expectedOutput = new List <string> {
                "Removing PJs", "shorts", "t-shirt", "sun visor", "sandals", "leaving house"
            };

            temperatureStrategy.ProcessCommands(inputCommands);
            CollectionAssert.AreEqual(expectedOutput, temperatureStrategy._output as List <string>);
            TestContext.WriteLine("Success");
        }
Exemple #2
0
        public void ShouldHaveFailWhenFirstElementIsNotANumber()
        {
            TemperatureType type           = TemperatureType.HOT;
            string          inputCommands  = "zz, 6, 4, 2, 1, 7";
            List <string>   expectedOutput = new List <string> {
                "fail"
            };
            TemperatureStrategy temperatureStrategy = StrategyResolver.GetTemperatureStrategy(type);

            temperatureStrategy.ProcessCommands(inputCommands);
            CollectionAssert.AreEqual(expectedOutput, temperatureStrategy._output as List <string>);
            TestContext.WriteLine(temperatureStrategy._message);
        }
Exemple #3
0
        public void ShouldHaveFailWhenAnyCommandIsNotANumber()
        {
            TemperatureType type           = TemperatureType.COLD;
            string          inputCommands  = "8, 6, zz, 4, 2, 5, 1, 7";
            List <string>   expectedOutput = new List <string> {
                "Removing PJs", "pants", "fail"
            };
            TemperatureStrategy temperatureStrategy = StrategyResolver.GetTemperatureStrategy(type);

            temperatureStrategy.ProcessCommands(inputCommands);
            CollectionAssert.AreEqual(expectedOutput, temperatureStrategy._output as List <string>);
            TestContext.WriteLine(temperatureStrategy._message);
        }
Exemple #4
0
        public void ShouldHaveFailWhenFirstCommandIsNotToRemovePajamas()
        {
            TemperatureType type           = TemperatureType.COLD;
            string          inputCommands  = "6";
            List <string>   expectedOutput = new List <string> {
                "fail"
            };
            TemperatureStrategy temperatureStrategy = StrategyResolver.GetTemperatureStrategy(type);

            temperatureStrategy.ProcessCommands(inputCommands);
            CollectionAssert.AreEqual(expectedOutput, temperatureStrategy._output as List <string>);
            TestContext.WriteLine(temperatureStrategy._message);
        }
Exemple #5
0
        public void ShouldHaveFailWhenSameClothingAddedTwice()
        {
            TemperatureType type           = TemperatureType.HOT;
            string          inputCommands  = "8, 6, 6";
            List <string>   expectedOutput = new List <string> {
                "Removing PJs", "shorts", "fail"
            };
            TemperatureStrategy temperatureStrategy = StrategyResolver.GetTemperatureStrategy(type);

            temperatureStrategy.ProcessCommands(inputCommands);
            CollectionAssert.AreEqual(expectedOutput, temperatureStrategy._output as List <string>);
            TestContext.WriteLine(temperatureStrategy._message);
        }
        static void Main(string[] args)
        {
            TemperatureType type          = TemperatureType.HOT;
            string          inputCommands = "8, 6, 6";
            //  "Removing PJs", "shorts", "fail"

            TemperatureStrategy temperatureStrategy = StrategyResolver.GetTemperatureStrategy(type);

            temperatureStrategy.ProcessCommands(inputCommands);
            Console.WriteLine(string.Join(",", temperatureStrategy._output));
            Console.WriteLine(temperatureStrategy._message);
            Console.ReadKey();
        }
        public void ShouldHaveProcessedWhenAllClothingAndLeaveOnColdDay()
        {
            string        inputCommands  = "8, 6, 3, 4, 2, 5, 1, 7";
            List <string> expectedOutput = new List <string> {
                "Removing PJs", "pants", "socks", "shirt", "hat", "jacket", "boots", "leaving house"
            };

            temperatureStrategy.ProcessCommands(inputCommands);
            CollectionAssert.AreEqual(expectedOutput, temperatureStrategy._output as List <string>);
            TestContext.WriteLine("Success");
        }