当前位置: 首页>>代码示例>>C#>>正文


C# TestTopLevel类代码示例

本文整理汇总了C#中TestTopLevel的典型用法代码示例。如果您正苦于以下问题:C# TestTopLevel类的具体用法?C# TestTopLevel怎么用?C# TestTopLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TestTopLevel类属于命名空间,在下文中一共展示了TestTopLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Bounds_Should_Be_Set_After_Layout_Pass

        public void Bounds_Should_Be_Set_After_Layout_Pass()
        {
            using (Locator.CurrentMutable.WithResolver())
            {
                this.RegisterServices();
                Locator.CurrentMutable.RegisterConstant(new LayoutManager(), typeof(ILayoutManager));

                var impl = new Mock<ITopLevelImpl>();
                impl.SetupProperty(x => x.ClientSize);
                impl.SetupProperty(x => x.Resized);

                var target = new TestTopLevel(impl.Object)
                {
                    Template = new ControlTemplate<TestTopLevel>(x =>
                        new ContentPresenter
                        {
                            [~ContentPresenter.ContentProperty] = x[~TestTopLevel.ContentProperty],
                        }),
                    Content = new TextBlock
                    {
                        Width = 321,
                        Height = 432,
                    }
                };

                target.LayoutManager.ExecuteLayoutPass();

                Assert.Equal(new Rect(0, 0, 321, 432), target.Bounds);
            }
        }
开发者ID:Scellow,项目名称:Perspex,代码行数:30,代码来源:TopLevelTests.cs

示例2: Height_Should_Not_Be_Set_On_Construction

        public void Height_Should_Not_Be_Set_On_Construction()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var impl = new Mock<ITopLevelImpl>();
                impl.Setup(x => x.ClientSize).Returns(new Size(123, 456));

                var target = new TestTopLevel(impl.Object);

                Assert.Equal(double.NaN, target.Height);
            }
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:12,代码来源:TopLevelTests.cs

示例3: Height_Should_Not_Be_Set_On_Construction

        public void Height_Should_Not_Be_Set_On_Construction()
        {
            using (PerspexLocator.EnterScope())
            {
                RegisterServices();

                var impl = new Mock<ITopLevelImpl>();
                impl.Setup(x => x.ClientSize).Returns(new Size(123, 456));

                var target = new TestTopLevel(impl.Object);

                Assert.Equal(double.NaN, target.Height);
            }
        }
开发者ID:YaroslavSinitsyn,项目名称:Perspex,代码行数:14,代码来源:TopLevelTests.cs

示例4: Layout_Pass_Should_Not_Be_Automatically_Scheduled

        public void Layout_Pass_Should_Not_Be_Automatically_Scheduled()
        {
            using (PerspexLocator.EnterScope())
            {
                RegisterServices();

                var impl = new Mock<ITopLevelImpl>();
                var target = new TestTopLevel(impl.Object);

                // The layout pass should be scheduled by the derived class.
                var layoutManagerMock = Mock.Get(target.LayoutManager);
                layoutManagerMock.Verify(x => x.ExecuteLayoutPass(), Times.Never);
            }
        }
开发者ID:YaroslavSinitsyn,项目名称:Perspex,代码行数:14,代码来源:TopLevelTests.cs

示例5: Layout_Pass_Should_Not_Be_Automatically_Scheduled

        public void Layout_Pass_Should_Not_Be_Automatically_Scheduled()
        {
            var services = TestServices.StyledWindow.With(layoutManager: Mock.Of<ILayoutManager>());

            using (UnitTestApplication.Start(services))
            {
                var impl = new Mock<ITopLevelImpl>();
                var target = new TestTopLevel(impl.Object);

                // The layout pass should be scheduled by the derived class.
                var layoutManagerMock = Mock.Get(LayoutManager.Instance);
                layoutManagerMock.Verify(x => x.ExecuteLayoutPass(), Times.Never);
            }
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:14,代码来源:TopLevelTests.cs

示例6: Activate_Should_Call_Impl_Activate

        public void Activate_Should_Call_Impl_Activate()
        {
            using (Locator.CurrentMutable.WithResolver())
            {
                this.RegisterServices();

                var impl = new Mock<ITopLevelImpl>();
                var target = new TestTopLevel(impl.Object);

                target.Activate();

                impl.Verify(x => x.Activate());
            }
        }
开发者ID:Scellow,项目名称:Perspex,代码行数:14,代码来源:TopLevelTests.cs

示例7: Activate_Should_Call_Impl_Activate

        public void Activate_Should_Call_Impl_Activate()
        {
            using (PerspexLocator.EnterScope())
            {
                RegisterServices();

                var impl = new Mock<ITopLevelImpl>();
                var target = new TestTopLevel(impl.Object);

                target.Activate();

                impl.Verify(x => x.Activate());
            }
        }
开发者ID:randydotnet,项目名称:Perspex,代码行数:14,代码来源:TopLevelTests.cs

示例8: Adding_Top_Level_As_Child_Should_Throw_Exception

        public void Adding_Top_Level_As_Child_Should_Throw_Exception()
        {
            using (PerspexLocator.EnterScope())
            {
                RegisterServices();

                var impl = new Mock<ITopLevelImpl>();
                impl.SetupAllProperties();
                var target = new TestTopLevel(impl.Object);
                var child = new TestTopLevel(impl.Object);

                target.Template = CreateTemplate();
                target.Content = child;

                Assert.Throws<InvalidOperationException>(() => target.ApplyTemplate());
            }
        }
开发者ID:randydotnet,项目名称:Perspex,代码行数:17,代码来源:TopLevelTests.cs

示例9: Impl_ClientSize_Should_Be_Set_After_Layout_Pass

        public void Impl_ClientSize_Should_Be_Set_After_Layout_Pass()
        {
            using (Locator.CurrentMutable.WithResolver())
            {
                this.RegisterServices();
                Locator.CurrentMutable.RegisterConstant(new LayoutManager(), typeof(ILayoutManager));

                var impl = new Mock<ITopLevelImpl>();

                var target = new TestTopLevel(impl.Object)
                {
                    Template = ControlTemplate.Create<TestTopLevel>(x =>
                        new ContentPresenter
                        {
                            [~ContentPresenter.ContentProperty] = x[~TestTopLevel.ContentProperty],
                        }),
                    Content = new TextBlock
                    {
                        Width = 321,
                        Height = 432,
                    }
                };

                target.LayoutManager.ExecuteLayoutPass();

                impl.VerifySet(x => x.ClientSize = new Size(321, 432));
            }
        }
开发者ID:MarkWalls,项目名称:Perspex,代码行数:28,代码来源:TopLevelTests.cs

示例10: Exiting_Application_Notifies_Top_Level

 public void Exiting_Application_Notifies_Top_Level()
 {
     using (UnitTestApplication.Start(TestServices.StyledWindow))
     {
         var impl = new Mock<ITopLevelImpl>();
         impl.SetupAllProperties();
         var target = new TestTopLevel(impl.Object);
         UnitTestApplication.Current.Exit();
         Assert.True(target.IsClosed);
     }
 }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:11,代码来源:TopLevelTests.cs

示例11: Impl_Deactivate_Should_Call_Raise_Activated_Event

        public void Impl_Deactivate_Should_Call_Raise_Activated_Event()
        {
            using (PerspexLocator.EnterScope())
            {
                RegisterServices();

                var impl = new Mock<ITopLevelImpl>();
                impl.SetupAllProperties();

                bool raised = false;
                var target = new TestTopLevel(impl.Object);
                target.Deactivated += (s, e) => raised = true;

                impl.Object.Deactivated();

                Assert.True(raised);
            }
        }
开发者ID:randydotnet,项目名称:Perspex,代码行数:18,代码来源:TopLevelTests.cs

示例12: Width_And_Height_Should_Be_Set_After_Window_Resize_Notification

        public void Width_And_Height_Should_Be_Set_After_Window_Resize_Notification()
        {
            using (Locator.CurrentMutable.WithResolver())
            {
                this.RegisterServices();

                var impl = new Mock<ITopLevelImpl>();
                impl.SetupAllProperties();
                impl.Setup(x => x.ClientSize).Returns(new Size(123, 456));

                // The user has resized the window, so we can no longer auto-size.
                var target = new TestTopLevel(impl.Object);
                impl.Object.Resized(new Size(100, 200));

                Assert.Equal(100, target.Width);
                Assert.Equal(200, target.Height);
            }
        }
开发者ID:Scellow,项目名称:Perspex,代码行数:18,代码来源:TopLevelTests.cs

示例13: Impl_Input_Should_Pass_Input_To_InputManager

        public void Impl_Input_Should_Pass_Input_To_InputManager()
        {
            using (Locator.CurrentMutable.WithResolver())
            {
                this.RegisterServices();

                var impl = new Mock<ITopLevelImpl>();
                impl.SetupAllProperties();
                var target = new TestTopLevel(impl.Object);

                var input = new RawKeyEventArgs(
                    new Mock<IKeyboardDevice>().Object,
                    0,
                    RawKeyEventType.KeyDown,
                    Key.A,
                    "A");
                impl.Object.Input(input);

                var inputManagerMock = Mock.Get(InputManager.Instance);
                inputManagerMock.Verify(x => x.Process(input));
            }
        }
开发者ID:Scellow,项目名称:Perspex,代码行数:22,代码来源:TopLevelTests.cs

示例14: Width_And_Height_Should_Be_Set_After_Window_Resize_Notification

        public void Width_And_Height_Should_Be_Set_After_Window_Resize_Notification()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var impl = new Mock<ITopLevelImpl>();
                impl.SetupAllProperties();
                impl.Setup(x => x.ClientSize).Returns(new Size(123, 456));

                // The user has resized the window, so we can no longer auto-size.
                var target = new TestTopLevel(impl.Object);
                impl.Object.Resized(new Size(100, 200));

                Assert.Equal(100, target.Width);
                Assert.Equal(200, target.Height);
            }
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:16,代码来源:TopLevelTests.cs

示例15: Width_And_Height_Should_Not_Be_Set_After_Layout_Pass

        public void Width_And_Height_Should_Not_Be_Set_After_Layout_Pass()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var impl = new Mock<ITopLevelImpl>();
                impl.Setup(x => x.ClientSize).Returns(new Size(123, 456));

                var target = new TestTopLevel(impl.Object);
                LayoutManager.Instance.ExecuteLayoutPass();

                Assert.Equal(double.NaN, target.Width);
                Assert.Equal(double.NaN, target.Height);
            }
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:14,代码来源:TopLevelTests.cs


注:本文中的TestTopLevel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。