public void OnEnable_ConsoleCaptureTrue() { TextConsoleUI textConsoleUI = SetupTextConsoleUI(out ITextDisplay textAdapter, out IConsole console); textConsoleUI.OnEnable(); Assert.True(console.IsCapturing); }
public void OnDisable_NoCaptureInBackground_ConsoleCaptureFalse() { TextConsoleUI textConsoleUI = SetupTextConsoleUI(out ITextDisplay textAdapter, out IConsole console); textConsoleUI.CaptureInBackground = false; textConsoleUI.OnEnable(); textConsoleUI.OnDisable(); Assert.False(console.IsCapturing); }
public void UpdateUI_NoMessages_WritesEmptyString() { TextConsoleUI textConsoleUI = SetupTextConsoleUI(out ITextDisplay textAdapter, out IConsole console); textConsoleUI.OnEnable(); textConsoleUI.GetType() .GetMethod("UpdateUI", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) .Invoke(textConsoleUI, null); Assert.AreEqual("", textAdapter.Text); }
public void UpdateUI_MessageGiven_WritesMessage() { const string message = "Hello World"; TextConsoleUI textConsoleUI = SetupTextConsoleUI(out ITextDisplay textAdapter, out IConsole console); ILogMessage logMessage = A.Fake <ILogMessage>(); A.CallTo(() => logMessage.Content).Returns(message); console.Messages.Add(logMessage); textConsoleUI.OnEnable(); textConsoleUI.GetType() .GetMethod("UpdateUI", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) .Invoke(textConsoleUI, null); Assert.AreEqual(message, textAdapter.Text); }