public void SortCheckerShouldRespectsDecimalSeparators()
        {
            string receivedOutput = "1,1";
            string expectedOutput = "1.1";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer));
        }
예제 #2
0
        public void SortCheckerShouldRespectsDecimalSeparators()
        {
            string receivedOutput = "1,1";
            string expectedOutput = "1.1";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer));
        }
예제 #3
0
        public void SortCheckerShouldReturnTrueWhenBothAreTotallyUnsortedStrings()
        {
            string receivedOutput = "9\n2\n3\n4\n5\n8\n6\n1\n7";
            string expectedOutput = "1\n6\n3\n9\n5\n2\n8\n7\n4";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #4
0
        public void SortCheckerShouldReturnTrueWhenGivenSameResultsUnsortedMultiLineStrings()
        {
            string receivedOutput = "Ивайло\nFoo\nBar";
            string expectedOutput = "Ивайло\nBar\nFoo";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #5
0
        public void SortCheckerShouldReturnTrueWhenGivenExactStrings()
        {
            string receivedOutput = "Ивайло";
            string expectedOutput = "Ивайло";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #6
0
        public void SortCheckerShouldReturnFalseWhenGivenDifferentStrings()
        {
            string receivedOutput = "Foo";
            string expectedOutput = "Bar";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer));
        }
예제 #7
0
        public void SortCheckerShouldRespectsTextCasing()
        {
            string receivedOutput = "Ивайло";
            string expectedOutput = "ивайло";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer));
        }
예제 #8
0
        public void SortCheckerShouldReturnInvalidNumberOfLinesWhenExpectedOutputHasMoreLines()
        {
            string receivedOutput = "Bar";
            string expectedOutput = "Bar\nFoo";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.InvalidNumberOfLines));
        }
예제 #9
0
        public void SortCheckerShouldReturnInvalidNumberOfLinesWhenGivenDifferentMultiLineStringsWithSameTextDifferentBlankLines()
        {
            string receivedOutput = "Bar\nFoo\n\n";
            string expectedOutput = "\n\nBar\nFoo";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.InvalidNumberOfLines));
        }
예제 #10
0
        public void SortCheckerShouldReturnTrueWhenGivenExactMultiLineStringsWithDifferentNewLineEndings()
        {
            string receivedOutput = "Ивайло\nFoo\nBar";
            string expectedOutput = "Ивайло\nFoo\nBar\n";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #11
0
        public void SortCheckerShouldReturnTrueWhenReceivedIsAlmostSortedAndExpectedIsFullSortedStrings()
        {
            string receivedOutput = "1\n2\n3\n4\n6\n5\n7\n8\n9";
            string expectedOutput = "1\n2\n3\n4\n5\n6\n7\n8\n9";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #12
0
        public void SortCheckerShouldReturnTrueWhenBothTextsAreUnsortedStrings()
        {
            string receivedOutput = "2\n1\n3";
            string expectedOutput = "3\n1\n2";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #13
0
        public void SortCheckerShouldReturnTrueWhenReceivedIsUnSortedAndExpectedIsSortedStrings()
        {
            string receivedOutput = "2\n1\n3";
            string expectedOutput = "1\n2\n3";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #14
0
        public void SortCheckerShouldReturnTrueWhenGivenExactMultiLineStringsWithDifferentNewLineEndings()
        {
            string receivedOutput = "Ивайло\nFoo\nBar";
            string expectedOutput = "Ивайло\nFoo\nBar\n";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #15
0
        public void SortCheckerShouldRespectsTextCasing()
        {
            string receivedOutput = "Ивайло";
            string expectedOutput = "ивайло";
            var    checker        = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer));
        }
예제 #16
0
        public void SortCheckerShouldReturnTrueWhenGivenExactStrings()
        {
            string receivedOutput = "Ивайло";
            string expectedOutput = "Ивайло";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
        public void SortCheckerShouldReturnCorrectAnswerInBiggerReversedTextsTest()
        {
            StringBuilder receivedOutput = new StringBuilder();

            for (int i = 1; i <= 100000; i++)
            {
                receivedOutput.AppendLine(i.ToString());
            }

            StringBuilder expectedOutput = new StringBuilder();

            for (int i = 100000; i >= 1; i--)
            {
                expectedOutput.AppendLine(i.ToString());
            }

            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput.ToString(), expectedOutput.ToString(), false);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #18
0
        public void SortCheckerShouldReturnWrongAnswerInBiggerDifferentTextsTest()
        {
            StringBuilder receivedOutput = new StringBuilder();

            for (int i = 0; i < 10; i++)
            {
                receivedOutput.AppendLine(i.ToString());
            }

            StringBuilder expectedOutput = new StringBuilder();

            for (int i = 10; i > 0; i--)
            {
                expectedOutput.AppendLine(i.ToString());
            }

            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput.ToString(), expectedOutput.ToString(), false);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer));
        }
예제 #19
0
        public void SortCheckerShouldReturnCorrectAnswerInBiggerReversedTextsTest()
        {
            StringBuilder receivedOutput = new StringBuilder();

            for (int i = 1; i <= 100000; i++)
            {
                receivedOutput.AppendLine(i.ToString());
            }

            StringBuilder expectedOutput = new StringBuilder();

            for (int i = 100000; i >= 1; i--)
            {
                expectedOutput.AppendLine(i.ToString());
            }

            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput.ToString(), expectedOutput.ToString());

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #20
0
        public void SortCheckerShouldReturnInvalidNumberOfLinesInBiggerDifferentNumberOfLinesTest()
        {
            StringBuilder receivedOutput = new StringBuilder();

            for (int i = 0; i < 10000; i++)
            {
                receivedOutput.AppendLine(i.ToString());
            }

            StringBuilder expectedOutput = new StringBuilder();

            for (int i = 0; i < 100000; i++)
            {
                expectedOutput.AppendLine(i.ToString());
            }

            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput.ToString(), expectedOutput.ToString());

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.InvalidNumberOfLines));
        }
예제 #21
0
        public void SortCheckerShouldReturnTrueWhenGivenSameResultsUnsortedMultiLineStrings()
        {
            string receivedOutput = "Ивайло\nFoo\nBar";
            string expectedOutput = "Ивайло\nBar\nFoo";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #22
0
        public void SortCheckerShouldReturnWrongAnswerInBiggerDifferentTextsTest()
        {
            StringBuilder receivedOutput = new StringBuilder();

            for (int i = 0; i < 10; i++)
            {
                receivedOutput.AppendLine(i.ToString());
            }

            StringBuilder expectedOutput = new StringBuilder();

            for (int i = 10; i > 0; i--)
            {
                expectedOutput.AppendLine(i.ToString());
            }

            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput.ToString(), expectedOutput.ToString());

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer));
        }
예제 #23
0
        public void SortCheckerShouldReturnInvalidNumberOfLinesWhenExpectedOutputHasMoreLines()
        {
            string receivedOutput = "Bar";
            string expectedOutput = "Bar\nFoo";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.InvalidNumberOfLines));
        }
예제 #24
0
        public void SortCheckerShouldReturnInvalidNumberOfLinesWhenGivenDifferentMultiLineStringsWithSameTextDifferentBlankLines()
        {
            string receivedOutput = "Bar\nFoo\n\n";
            string expectedOutput = "\n\nBar\nFoo";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.InvalidNumberOfLines));
        }
예제 #25
0
        public void SortCheckerShouldReturnInvalidNumberOfLinesInBiggerDifferentNumberOfLinesTest()
        {
            StringBuilder receivedOutput = new StringBuilder();

            for (int i = 0; i < 10000; i++)
            {
                receivedOutput.AppendLine(i.ToString());
            }

            StringBuilder expectedOutput = new StringBuilder();

            for (int i = 0; i < 100000; i++)
            {
                expectedOutput.AppendLine(i.ToString());
            }

            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput.ToString(), expectedOutput.ToString(), false);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.InvalidNumberOfLines));
        }
예제 #26
0
        public void SortCheckerShouldReturnTrueWhenBothTextsAreUnsortedStrings()
        {
            string receivedOutput = "2\n1\n3";
            string expectedOutput = "3\n1\n2";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #27
0
        public void SortCheckerShouldReturnTrueWhenReceivedIsAlmostSortedAndExpectedIsFullSortedStrings()
        {
            string receivedOutput = "1\n2\n3\n4\n6\n5\n7\n8\n9";
            string expectedOutput = "1\n2\n3\n4\n5\n6\n7\n8\n9";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #28
0
        public void SortCheckerShouldReturnTrueWhenBothAreTotallyUnsortedStrings()
        {
            string receivedOutput = "9\n2\n3\n4\n5\n8\n6\n1\n7";
            string expectedOutput = "1\n6\n3\n9\n5\n2\n8\n7\n4";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }
예제 #29
0
        public void SortCheckerShouldReturnFalseWhenGivenDifferentStrings()
        {
            string receivedOutput = "Foo";
            string expectedOutput = "Bar";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false);

            Assert.IsNotNull(checkerResult);
            Assert.IsFalse(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer));
        }
예제 #30
0
        public void SortCheckerShouldReturnTrueWhenReceivedIsUnSortedAndExpectedIsSortedStrings()
        {
            string receivedOutput = "2\n1\n3";
            string expectedOutput = "1\n2\n3";
            var checker = new SortChecker();

            var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput);

            Assert.IsNotNull(checkerResult);
            Assert.IsTrue(checkerResult.IsCorrect);
            Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.Ok));
        }