public void ReadLine_NoLinesAvailable_ReturnsNull() { CreateConsole(); string line = TestableScriptingConsole.ReadLine(0); Assert.IsNull(line); }
public void IsLineAvailable_TwoLinesRead_ReturnsFalse() { WriteTwoLinesEachFollowedByEnterKey(); TestableScriptingConsole.ReadLine(0); TestableScriptingConsole.ReadLine(0); bool result = TestableScriptingConsole.IsLineAvailable; Assert.IsFalse(result); }
public void ReadLine_WriteThreeCharactersFollowedByEnterKey_ReturnsFirstThreeCharacters() { WriteThreeCharactersFollowedByEnterKey(); string line = TestableScriptingConsole.ReadLine(0); string expectedLine = "ABC"; Assert.AreEqual(expectedLine, line); }
public void ReadLine_WriteTwoLinesWithThreeCharactersInEachLine_SecondLineReadReturnsSecondLinesCharacters() { WriteTwoLinesEachFollowedByEnterKey(); TestableScriptingConsole.ReadLine(0); string secondLine = TestableScriptingConsole.ReadLine(0); string expectedSecondLine = "DEF"; Assert.AreEqual(expectedSecondLine, secondLine); }
public void ReadLine_AutoIndentIsZero_NoTextWrittenToConsoleTextEditor() { CreateConsole(); FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A); FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Enter); FakeConsoleTextEditor.IsAppendCalled = false; TestableScriptingConsole.ReadLine(0); Assert.IsFalse(FakeConsoleTextEditor.IsAppendCalled); }
public void ReadLine_OneLineWaitingAndAutoIndentIsTwo_TwoSpacesAddedToLineText() { CreateConsole(); FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A); FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Enter); int indent = 2; string line = TestableScriptingConsole.ReadLine(indent); string expectedLine = " A"; Assert.AreEqual(expectedLine, line); }
public void ReadLine_AutoIndentIsTwo_TwoSpacesWrittenToConsoleTextEditor() { CreateConsole(); FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A); FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Enter); int indent = 2; TestableScriptingConsole.ReadLine(indent); string expectedText = " "; Assert.AreEqual(expectedText, FakeConsoleTextEditor.TextPassedToAppend); }