public void IsVisible_Should_Initially_Be_False() { using (UnitTestApplication.Start(TestServices.MockWindowingPlatform)) { var target = new TestWindowBase(); Assert.False(target.IsVisible); } }
public void IsVisible_Should_Be_True_After_Show() { using (UnitTestApplication.Start(TestServices.StyledWindow)) { var target = new TestWindowBase(); target.Show(); Assert.True(target.IsVisible); } }
public void Showing_Should_Start_Renderer() { using (UnitTestApplication.Start(TestServices.StyledWindow)) { var renderer = new Mock <IRenderer>(); var target = new TestWindowBase(renderer.Object); target.Show(); renderer.Verify(x => x.Start(), Times.Once); } }
public void Activate_Should_Call_Impl_Activate() { using (UnitTestApplication.Start(TestServices.StyledWindow)) { var impl = new Mock <IWindowBaseImpl>(); var target = new TestWindowBase(impl.Object); target.Activate(); impl.Verify(x => x.Activate()); } }
public void Showing_Should_Raise_Opened() { using (UnitTestApplication.Start(TestServices.StyledWindow)) { var target = new TestWindowBase(); var raised = false; target.Opened += (s, e) => raised = true; target.Show(); Assert.True(raised); } }
public void Setting_IsVisible_True_Shows_Window() { var windowImpl = new Mock <IPopupImpl>(); windowImpl.Setup(x => x.Scaling).Returns(1); using (UnitTestApplication.Start(TestServices.StyledWindow)) { var target = new TestWindowBase(windowImpl.Object); target.IsVisible = true; windowImpl.Verify(x => x.Show()); } }
public void Impl_Deactivate_Should_Call_Raise_Deativated_Event() { using (UnitTestApplication.Start(TestServices.StyledWindow)) { var impl = new Mock <IWindowBaseImpl>(); impl.SetupAllProperties(); bool raised = false; var target = new TestWindowBase(impl.Object); target.Deactivated += (s, e) => raised = true; impl.Object.Deactivated(); Assert.True(raised); } }
public void Setting_IsVisible_False_Hides_Window() { var windowImpl = new Mock <IPopupImpl>(); windowImpl.Setup(x => x.DesktopScaling).Returns(1); windowImpl.Setup(x => x.RenderScaling).Returns(1); using (UnitTestApplication.Start(TestServices.StyledWindow)) { var target = new TestWindowBase(windowImpl.Object); target.Show(); target.IsVisible = false; windowImpl.Verify(x => x.Hide()); } }
public void IsVisible_Should_Be_False_Atfer_Impl_Signals_Close() { var windowImpl = new Mock <IPopupImpl>(); windowImpl.Setup(x => x.Scaling).Returns(1); windowImpl.SetupProperty(x => x.Closed); using (UnitTestApplication.Start(TestServices.StyledWindow)) { var target = new TestWindowBase(windowImpl.Object); target.Show(); windowImpl.Object.Closed(); Assert.False(target.IsVisible); } }
public void Renderer_Should_Be_Disposed_When_Impl_Signals_Close() { using (UnitTestApplication.Start(TestServices.StyledWindow)) { var renderer = new Mock <IRenderer>(); var windowImpl = new Mock <IPopupImpl>(); windowImpl.Setup(x => x.Scaling).Returns(1); windowImpl.SetupProperty(x => x.Closed); windowImpl.Setup(x => x.CreateRenderer(It.IsAny <IRenderRoot>())).Returns(renderer.Object); var target = new TestWindowBase(windowImpl.Object); target.Show(); windowImpl.Object.Closed(); renderer.Verify(x => x.Dispose(), Times.Once); } }
public void Impl_ClientSize_Should_Be_Set_After_Layout_Pass() { using (UnitTestApplication.Start(TestServices.StyledWindow)) { var impl = Mock.Of <IWindowBaseImpl>(x => x.Scaling == 1); var target = new TestWindowBase(impl) { Template = CreateTemplate(), Content = new TextBlock { Width = 321, Height = 432, } }; LayoutManager.Instance.ExecuteInitialLayoutPass(target); Mock.Get(impl).Verify(x => x.Resize(new Size(321, 432))); } }
public void Impl_ClientSize_Should_Be_Set_After_Layout_Pass() { using (UnitTestApplication.Start(TestServices.StyledWindow)) { var impl = Mock.Of <IWindowBaseImpl>(x => x.Scaling == 1); Mock.Get(impl).Setup(x => x.Resize(It.IsAny <Size>())).Callback(() => { }); var target = new TestWindowBase(impl) { Template = CreateTemplate(), Content = new TextBlock { Width = 321, Height = 432, }, IsVisible = true, }; target.LayoutManager.ExecuteInitialLayoutPass(target); Mock.Get(impl).Verify(x => x.Resize(new Size(321, 432))); } }