• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TestTopLevel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Impl_ClientSize_Should_Be_Set_After_Layout_Pass

        public void Impl_ClientSize_Should_Be_Set_After_Layout_Pass()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var impl = Mock.Of<ITopLevelImpl>(x => x.Scaling == 1);

                var target = new TestTopLevel(impl)
                {
                    Template = CreateTemplate(),
                    Content = new TextBlock
                    {
                        Width = 321,
                        Height = 432,
                    }
                };

                LayoutManager.Instance.ExecuteInitialLayoutPass(target);

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


示例17: Bounds_Should_Be_Set_After_Layout_Pass

        public void Bounds_Should_Be_Set_After_Layout_Pass()
        {
            using (PerspexLocator.EnterScope())
            {
                RegisterServices();
                PerspexLocator.CurrentMutable.Bind<ILayoutManager>().ToConstant(new LayoutManager());

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

                var target = new TestTopLevel(impl.Object)
                {
                    Template = CreateTemplate(),
                    Content = new TextBlock
                    {
                        Width = 321,
                        Height = 432,
                    }
                };

                target.LayoutManager.ExecuteLayoutPass();

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


示例18: Impl_Input_Should_Pass_Input_To_InputManager

        public void Impl_Input_Should_Pass_Input_To_InputManager()
        {
            using (PerspexLocator.EnterScope())
            {
                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, InputModifiers.None);
                impl.Object.Input(input);

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


示例19: Bounds_Should_Be_Set_After_Layout_Pass

        public void Bounds_Should_Be_Set_After_Layout_Pass()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var impl = new Mock<ITopLevelImpl>();
                impl.SetupProperty(x => x.ClientSize);
                impl.SetupProperty(x => x.Resized);
                impl.SetupGet(x => x.Scaling).Returns(1);

                var target = new TestTopLevel(impl.Object)
                {
                    Template = CreateTemplate(),
                    Content = new TextBlock
                    {
                        Width = 321,
                        Height = 432,
                    }
                };

                LayoutManager.Instance.ExecuteInitialLayoutPass(target);

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


示例20: Width_And_Height_Should_Not_Be_Set_After_Layout_Pass

        public void Width_And_Height_Should_Not_Be_Set_After_Layout_Pass()
        {
            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);
                LayoutManager.Instance.ExecuteLayoutPass();

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TestTraceWriter类代码示例发布时间:2022-05-24
下一篇:
C# TestTask类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap