public void DrawBackground_BackgroundDrawn() { const ConsoleColor Color = ConsoleColor.DarkBlue; var stubbedWindow = new StubbedWindow { BackgroundColorGet = () => Color }; var sut = new StubbedConsoleControl(stubbedWindow) { Area = new Rectangle(1, 2, 3, 4), Parent = stubbedWindow }; bool backgroundDrawn = false; var graphics = new StubIConsoleGraphics { DrawBackgroundConsoleColorRectangle = (color, rect) => { color.Should().Be(Color); rect.Should().Be(sut.Area); backgroundDrawn = true; } }; sut.DoDrawBackground(graphics); backgroundDrawn.Should().BeTrue(); }
public void DrawBackground_DrawingInhibited_LoggedNotDrawn() { var stubbedWindow = new StubbedWindow { DrawingInhibitedGet = () => true }; bool backgroundDrawn = false; var graphics = new StubIConsoleGraphics { DrawBackgroundConsoleColorRectangle = (color, rect) => backgroundDrawn = true }; bool inhibitLogged = false; var sut = new StubbedConsoleControl(stubbedWindow); using var logger = new TestLogger(CheckDrawLog); sut.DoDrawBackground(graphics); inhibitLogged.Should().BeTrue(); backgroundDrawn.Should().BeFalse(); void CheckDrawLog(string msg) { if (msg.Contains("drawing inhibited")) { inhibitLogged = true; } } }