public void CaseInsensitiveCheckerShouldReturnWrongAnswerInBiggerTextsWithLastLineDifferentTest() { StringBuilder receivedOutput = new StringBuilder(); for (int i = 0; i < 100000; i++) { receivedOutput.AppendLine(i.ToString()); } receivedOutput.Append(1); StringBuilder expectedOutput = new StringBuilder(); for (int i = 0; i < 100000; i++) { expectedOutput.AppendLine(i.ToString()); } expectedOutput.Append(2); var checker = new CaseInsensitiveChecker(); 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)); }
public void CaseInsensitiveCheckerShouldReturnWrongAnswerWhenGivenDifferentMultiLineStringsWithSameTextDifferentBlankLines() { string receivedOutput = "BAr\nFoo\n\n"; string expectedOutput = "\n\nBar\nFOo"; var checker = new CaseInsensitiveChecker(); var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false); Assert.IsNotNull(checkerResult); Assert.IsFalse(checkerResult.IsCorrect); Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer)); }
public void CaseInsensitiveCheckerShouldReturnInvalidNumberOfLinesWhenGivenDifferentMultiLineStringsWithSameText() { string receivedOutput = "Bar\nFoo\n\n"; string expectedOutput = "Bar\nFoo"; var checker = new CaseInsensitiveChecker(); var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false); Assert.IsNotNull(checkerResult); Assert.IsFalse(checkerResult.IsCorrect); Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.InvalidNumberOfLines)); }
public void CaseInsensitiveCheckerShouldReturnTrueWhenGivenCaseInsensitiveStrings() { string receivedOutput = "НиколАй"; string expectedOutput = "НикОлай"; var checker = new CaseInsensitiveChecker(); 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 CaseInsensitiveCheckerShouldReturnFalseWhenGivenDifferentStrings() { string receivedOutput = "Foo"; string expectedOutput = "Bar"; var checker = new CaseInsensitiveChecker(); var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false); Assert.IsNotNull(checkerResult); Assert.IsFalse(checkerResult.IsCorrect); Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer)); }
public void CaseInsensitiveCheckerShouldReturnTrueWhenGivenCaseInsensitiveMultiLineStringsWithDifferentNewLineEndings() { string receivedOutput = "Николай\nFOo\nBar"; string expectedOutput = "Николай\nFoo\nBAr\n"; var checker = new CaseInsensitiveChecker(); 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 CaseInsensitiveCheckerShouldReturnInvalidNumberOfLinesWhenExpectedOutputHasMoreLines() { string receivedOutput = "Bar"; string expectedOutput = "Bar\nFoo"; var checker = new CaseInsensitiveChecker(); var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false); Assert.IsNotNull(checkerResult); Assert.IsFalse(checkerResult.IsCorrect); Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.InvalidNumberOfLines)); }
public void CaseInsensitiveCheckerShouldRespectsDecimalSeparators() { string receivedOutput = "1,1"; string expectedOutput = "1.1"; var checker = new CaseInsensitiveChecker(); var checkerResult = checker.Check(string.Empty, receivedOutput, expectedOutput, false); Assert.IsNotNull(checkerResult); Assert.IsFalse(checkerResult.IsCorrect); Assert.IsTrue(checkerResult.ResultType.HasFlag(CheckerResultType.WrongAnswer)); }
public void CaseInsensitiveCheckerShouldNotRespectsTextCasing() { string receivedOutput = "Николай"; string expectedOutput = "николай"; var checker = new CaseInsensitiveChecker(); 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 CaseInsensitiveCheckShouldReturnCorrectAnswerInBiggerSameTextsDifferentCaseTest() { StringBuilder receivedOutput = new StringBuilder(); for (int i = 0; i < 128; i++) { receivedOutput.AppendLine(((char)i).ToString().ToLower()); } StringBuilder expectedOutput = new StringBuilder(); for (int i = 0; i < 128; i++) { expectedOutput.AppendLine(((char)i).ToString().ToUpper()); } var checker = new CaseInsensitiveChecker(); 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)); }
public void CaseInsensitiveCheckerShouldReturnInvalidNumberOfLinesInBiggerDifferentNumberOfLinesTest() { 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 CaseInsensitiveChecker(); 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)); }
public void CaseInsensitiveCheckShouldReturnCorrectAnswerInBiggerSameTextsTest() { StringBuilder receivedOutput = new StringBuilder(); for (int i = 0; i < 100000; i++) { receivedOutput.AppendLine(i.ToString()); } StringBuilder expectedOutput = new StringBuilder(); for (int i = 0; i < 100000; i++) { expectedOutput.AppendLine(i.ToString()); } var checker = new CaseInsensitiveChecker(); 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)); }