Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Scenes.Terminal.Tests ConsoleTests
Namespace: DeltaEngine.Scenes.Terminal.Tests
Assembly: DeltaEngine.Scenes.Terminal.Tests (in DeltaEngine.Scenes.Terminal.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The ConsoleTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ConsoleTests | Initializes a new instance of the ConsoleTests class |
Methods
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void CreateConsole() { if (!IsMockResolver) return; //ncrunch: no coverage Assert.AreEqual(0.01f, console.DrawArea.Left); Assert.AreEqual(0.1f, console.DrawArea.Top); Assert.AreEqual(0.99f, console.DrawArea.Right); Assert.AreEqual(0.98f, console.DrawArea.Width); Assert.AreEqual(0.352f, console.DrawArea.Bottom); Assert.IsTrue(console.IsEnabled); Assert.AreEqual(Console.EnabledBackgroundColor, console.Color); }
[Test, CloseAfterFirstFrame] public void TypingGoesIntoTheCommandLine() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.A, Key.B, Key.C });
[Test, CloseAfterFirstFrame] public void PressingEnterExecutesCommandTrimsItAndMovesItToHistory() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.A, Key.Space, Key.Space, Key.B, Key.Enter });
[Test, CloseAfterFirstFrame] public void FillingHistoryRemovesTheFirstHistoryLine() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.D1, Key.Enter, Key.D2, Key.Enter, Key.D3, Key.Enter, Key.D4, Key.Enter }); Assert.AreEqual( "> 2\nError: Unknown console command '2'\n" + "> 3\nError: Unknown console command '3'\n" + "> 4\nError: Unknown console command '4'", console.history.Text); }
[Test, CloseAfterFirstFrame] public void RenderDisabledConsole() { if (!IsMockResolver) return; //ncrunch: no coverage console.IsEnabled = false; }
[Test, CloseAfterFirstFrame] public void TypingDoesNotGoIntoTheCommandLineIfNotEnabled() { if (keyboard == null) return; //ncrunch: no coverage console.IsEnabled = false; PressKeys(new List<Key> { Key.A, Key.B, Key.C });
[Test, CloseAfterFirstFrame] public void TypingUpdatesAutoCompletions() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.A });
[Test, CloseAfterFirstFrame] public void TabAutoCompletes() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.A, Key.D, Key.D, Key.F, Key.Tab });
[Test, CloseAfterFirstFrame] public void PressingF12Inactivates() { if (keyboard == null) return; //ncrunch: no coverage PressKey(Key.F12); Assert.IsFalse(console.IsActive); Assert.IsFalse(console.history.IsActive); Assert.IsFalse(console.command.IsActive); Assert.IsFalse(console.autoCompletions.IsActive); }
[Test, CloseAfterFirstFrame] public void PressingF12TwiceReactivates() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.F12, Key.F12 });
[Test, CloseAfterFirstFrame] public void PressingCursorUpGetsTheLastCommand() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.D1, Key.Enter, Key.D2, Key.Enter, Key.CursorUp });
[Test, CloseAfterFirstFrame] public void PressingCursorUpTwiceGetsTheLastButOneCommand() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.D1, Key.Enter, Key.D2, Key.Enter, Key.CursorUp, Key.CursorUp });
[Test, CloseAfterFirstFrame] public void PressingCursorUpManyTimesGetsTheFirstCommand() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.D1, Key.Enter, Key.D2, Key.Enter, Key.CursorUp, Key.CursorUp, Key.CursorUp }); Assert.AreEqual("> 1_", console.command.Text); }
[Test, CloseAfterFirstFrame] public void PressingCursorUpTwiceThenCursorDownGetsTheLastCommand() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.D1, Key.Enter, Key.D2, Key.Enter, Key.CursorUp, Key.CursorUp, Key.CursorDown }); Assert.AreEqual("> 2_", console.command.Text); }
[Test, CloseAfterFirstFrame] public void PressingCursorUpThenCursorDownLotsOfTimesClearsTheCommandLine() { if (keyboard == null) return; //ncrunch: no coverage PressKeys(new List<Key> { Key.D1, Key.Enter, Key.D2, Key.Enter, Key.CursorUp, Key.CursorUp, Key.CursorDown, Key.CursorDown }); Assert.AreEqual("> _", console.command.Text); }
See Also