Exemple #1
0
        public void Given_WrongSecondArgument_Then_ProgramWritesErrorMessage(string firstArgument, string secondArgument)
        {
            var memory  = new MemoryWriter();
            var program = TestUtils.CreateTestProgram(memory);

            program.Run(new[] { firstArgument, secondArgument });

            Assert.AreEqual(TestUtils.GetCannotParseMessage(secondArgument), memory.ReadLast());
        }
Exemple #2
0
        public void Given_CorruptedData_Then_ProgramWritesCorrectMessage(string firstArgument, string secondArgument)
        {
            var memory  = new MemoryWriter();
            var program = TestUtils.CreateTestProgram(memory);

            program.Run(new[] { firstArgument, secondArgument });

            Assert.AreEqual(TestUtils.GetUnexpectedErrorMessage(), memory.ReadLast());
        }
Exemple #3
0
        public void Given_WrongParameterCount_Then_ProgramWritesErrorMessage(int count)
        {
            var memory     = new MemoryWriter();
            var program    = TestUtils.CreateTestProgram(memory);
            var parameters = TestDataSources.StringEmitter().Take(count).ToArray();

            program.Run(parameters);

            Assert.AreEqual(TestUtils.GetWrongCountMessage(count), memory.ReadLast());
        }
Exemple #4
0
        public void Given_StartDateBefore_Then_ProgramWritesErrorMessage(string firstArgument,
                                                                         string secondArgument, string expectedOutput)
        {
            var memory  = new MemoryWriter();
            var program = TestUtils.CreateTestProgram(memory);

            program.Run(new[] { firstArgument, secondArgument });

            Assert.AreEqual(expectedOutput, memory.ReadLast());
        }
Exemple #5
0
        public void Given_HappyCases_Then_ProgramWritesCorrectInterval(string firstArgument,
                                                                       string secondArgument, string expectedOutput)
        {
            var memory  = new MemoryWriter();
            var program = TestUtils.CreateTestProgram(memory);

            program.Run(new[] { firstArgument, secondArgument });

            Assert.AreEqual(expectedOutput, memory.ReadLast());
        }