public void DrawClientArea_ChildControlsDrawn() { var stubbedWindow = new StubbedWindow(); var sut = new StubbedConsoleControl(stubbedWindow) { Area = new Rectangle(1, 2, 3, 4), Parent = stubbedWindow }; var child1 = new StubbedConsoleControl(stubbedWindow) { Parent = sut }; var child2 = new StubbedConsoleControl(stubbedWindow) { Parent = sut }; child1.ResetMethodCount(); child2.ResetMethodCount(); sut.DoDrawClientArea(new StubIConsoleGraphics()); child1.GetMethodCount(StubbedConsoleControl.MethodDrawBackground).Should().Be(1); child2.GetMethodCount(StubbedConsoleControl.MethodDrawBackground).Should().Be(1); }
public void DrawClientArea_DrawingInhibited_LoggedNotDrawn() { var stubbedWindow = new StubbedWindow { DrawingInhibitedGet = () => true }; bool inhibitLogged = false; var sut = new StubbedConsoleControl(stubbedWindow) { Parent = stubbedWindow }; var child1 = new StubbedConsoleControl(stubbedWindow) { Parent = sut }; var child2 = new StubbedConsoleControl(stubbedWindow) { Parent = sut }; child1.ResetMethodCount(); child2.ResetMethodCount(); using var logger = new TestLogger(CheckDrawLog); sut.DoDrawClientArea(new StubIConsoleGraphics()); inhibitLogged.Should().BeTrue(); child1.GetMethodCount(StubbedConsoleControl.MethodDrawBackground).Should().Be(0); child2.GetMethodCount(StubbedConsoleControl.MethodDrawBackground).Should().Be(0); void CheckDrawLog(string msg) { if (msg.Contains("drawing inhibited")) { inhibitLogged = true; } } }