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


C# TestViewModel类代码示例

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


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

示例1: should_load_the_user_from_the_id_on_the_principal

        public void should_load_the_user_from_the_id_on_the_principal()
        {
            var model = new TestViewModel();
            _behavior.PrepareInput(model);

            _repo.AssertWasCalled(r => r.Load<User>(_userId));
        }
开发者ID:Anupam-,项目名称:fubumvc-contrib,代码行数:7,代码来源:SetUpCurrentUserTester.cs

示例2: TestPropertyChangedSend

        public void TestPropertyChangedSend()
        {
            Messenger.Reset();
            var receivedDateTimeMessengerOld = DateTime.MaxValue;
            var receivedDateTimeMessengerNew = DateTime.MinValue;
            var receivedDateTimeLocal = DateTime.MinValue;

            Messenger.Default.Register<PropertyChangedMessage<DateTime>>(this, m =>
                {
                    if (m.PropertyName == TestViewModel.LastChanged1PropertyName)
                    {
                        receivedDateTimeMessengerOld = m.OldValue;
                        receivedDateTimeMessengerNew = m.NewValue;
                    }
                });

            var vm = new TestViewModel();
            vm.PropertyChanged += (s, e) =>
                {
                    if (e.PropertyName == TestViewModel.LastChanged1PropertyName)
                    {
                        receivedDateTimeLocal = vm.LastChanged1;
                    }
                };

            var now = DateTime.Now;
            vm.LastChanged1 = now;

            Assert.AreEqual(now, vm.LastChanged1);
            Assert.AreEqual(DateTime.MinValue, receivedDateTimeMessengerOld);
            Assert.AreEqual(now, receivedDateTimeMessengerNew);
            Assert.AreEqual(now, receivedDateTimeLocal);
        }
开发者ID:lavige777,项目名称:GalaSoft.MvvmLight,代码行数:33,代码来源:ViewModelBaseTest.cs

示例3: ReturnsViewModelCommandManagerForViewModel

            public void ReturnsViewModelCommandManagerForViewModel()
            {
                var viewModel = new TestViewModel();
                var viewModelCommandManager = ViewModelCommandManager.Create(viewModel);

                Assert.IsNotNull(viewModelCommandManager);
            }
开发者ID:justdude,项目名称:DbExport,代码行数:7,代码来源:ViewModelCommandManagerFacts.cs

示例4: InitializeTest

 public virtual void InitializeTest(TestViewModel viewModel) {
     // This is called when a TestViewModel is created
     viewModel.DoSomething.Action = this.DoSomethingHandler;
     viewModel.DoSomethingElse.Action = this.DoSomethingElseHandler;
     viewModel.CommandReference.Action = this.CommandReferenceHandler;
     TestViewModelManager.Add(viewModel);
 }
开发者ID:grofit,项目名称:uFrame.MVVM.NodeCanvasPlugin,代码行数:7,代码来源:Controllers.designer.cs

示例5: PropertyWithDataTypePasswordAttributeShouldHaveTheTypePassword

 public void PropertyWithDataTypePasswordAttributeShouldHaveTheTypePassword()
 {
     var model = new TestViewModel();
     var tag = MvcMockHelpers.GetHtmlHelper(model).Input(x => x.Password);
     tag.TagName().ShouldBe("input");
     tag.Attr("type").ShouldBe("password");
 }
开发者ID:eByte23,项目名称:SchoStack,代码行数:7,代码来源:DataAnnotationConventionTests.cs

示例6: SetUp

 public void SetUp()
 {
     viewModel = new TestViewModel()
                     {
                         Id = -10
                     };
 }
开发者ID:chester89,项目名称:Modeler,代码行数:7,代码来源:CanExecuteTests.cs

示例7: ThrowsArgumentNullExceptionForNullHandler

            public void ThrowsArgumentNullExceptionForNullHandler()
            {
                var viewModel = new TestViewModel();
                var viewModelCommandManager = ViewModelCommandManager.Create(viewModel);

                ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => viewModelCommandManager.AddHandler(null));
            }            
开发者ID:justdude,项目名称:DbExport,代码行数:7,代码来源:ViewModelCommandManagerFacts.cs

示例8: ExpressionEvaluator_UpdateSource_Simple

        public void ExpressionEvaluator_UpdateSource_Simple()
        {
            var viewModel = new TestViewModel() { SubObject = new TestViewModel2() { Value = "hello" } };
            var view = new RedwoodView()
            {
                DataContext = viewModel,
                Children =
                {
                    new HtmlGenericControl("html")
                    {
                        Children =
                        {
                            new TextBox()
                            {
                                ID = "txb"
                            }
                            .WithBinding(TextBox.TextProperty, new ValueBindingExpression("Value"))
                        }
                    }
                    .WithBinding(RedwoodBindableControl.DataContextProperty, new ValueBindingExpression("SubObject"))
                }
            };
            var textbox = view.FindControl("txb") as TextBox;
            var binding = textbox.GetBinding(TextBox.TextProperty) as ValueBindingExpression;

            binding.UpdateSource("test", textbox, TextBox.TextProperty);

            Assert.AreEqual("test", viewModel.SubObject.Value);
        }
开发者ID:adamjez,项目名称:dotvvm,代码行数:29,代码来源:ExpressionEvaluatorComplexTests.cs

示例9: ViewModel_NavigationReturnsNavigation

 public void ViewModel_NavigationReturnsNavigation()
 {
     var mockNav = Mock.Of<INavigation>();
     Container.Current.RegisterInstance<INavigation>(mockNav);
     var t = new TestViewModel();
     Assert.That(t.Navigation, Is.Not.Null);
 }
开发者ID:benbillbob,项目名称:BusinessManager,代码行数:7,代码来源:ViewModel_Test.cs

示例10: PropertyWithHiddenInputAttributeShouldMakeTheTypeHidden

 public void PropertyWithHiddenInputAttributeShouldMakeTheTypeHidden()
 {
     var model = new TestViewModel();
     var tag = MvcMockHelpers.GetHtmlHelper(model).Input(x => x.Hidden);
     tag.TagName().ShouldBe("input");
     tag.Attr("type").ShouldBe("hidden");
 }
开发者ID:eByte23,项目名称:SchoStack,代码行数:7,代码来源:DataAnnotationConventionTests.cs

示例11: InputOfPropertyShouldBeCheckboxIfPropertyIsABool

 public void InputOfPropertyShouldBeCheckboxIfPropertyIsABool()
 {
     var model = new TestViewModel();
     var helper = MvcMockHelpers.GetHtmlHelper(model);
     var tag = helper.Input(x => x.IsCorrect);
     tag.Attr("type").ShouldBe("checkbox");
 }
开发者ID:eByte23,项目名称:SchoStack,代码行数:7,代码来源:DefaultHtmlConventionTests.cs

示例12: Can_Use_MerchelloContext_In_RazorEngine

        public void Can_Use_MerchelloContext_In_RazorEngine()
        {
            //// Arrange
            var model = new TestViewModel();
            model.MerchelloContext = MerchelloContext.Current;
            model.Product = _product.ToProductDisplay();

            var template = @"
            @{
                var product = Model.MerchelloContext.Services.ProductService.GetByKey(Model.Product.Key);
            }

            <html>
                <body>
                    <div>@Model.Product.Name, @Model.Product.Sku, @Model.Product.Price</div>

                    <ul>
                    @foreach(var option in Model.Product.ProductOptions)
                    {
                        <li>@option.Name</li>
                    }
                    </ul>
                </body>
            </html>";

            //// Act
            var result = Razor.Parse(template, model);

            //// Assert
            Assert.NotNull(result);
            Assert.IsTrue(result.Contains("Color"));
        }
开发者ID:VDBBjorn,项目名称:Merchello,代码行数:32,代码来源:RazorEngineTests.cs

示例13: TestDisableCommandAndRectangle

        public void TestDisableCommandAndRectangle()
        {
            var trigger = new EventToCommand
            {
                MustToggleIsEnabledValue = true
            };

            var rectangle = new Rectangle();

            ((IAttachedObject)trigger).Attach(rectangle);

            var vm = new TestViewModel();
            var binding = new Binding
            {
                Source = vm.ToggledCommand
            };

            vm.EnableToggledCommand = false;

            #if SILVERLIGHT3
            trigger.Command = binding;
            #else
            BindingOperations.SetBinding(trigger, EventToCommand.CommandProperty, binding);
            #endif

            #if !SILVERLIGHT
            Assert.IsFalse(rectangle.IsEnabled);
            #endif
            trigger.Invoke();
            Assert.IsFalse(vm.CommandExecuted);
        }
开发者ID:Jedzia,项目名称:BackBock,代码行数:31,代码来源:EventToCommandTest.cs

示例14: ExtenstionTest2

        public void ExtenstionTest2() {
            var service = new TestDialogService();
            var viewModel = new TestViewModel();
            var parentViewModel = new TestViewModel();
            var commands = new List<UICommand>();

            service = new TestDialogService();
            service.ShowDialog(commands, "title1", viewModel);
            Assert.AreEqual(commands, service.Commands);
            Assert.AreEqual("title1", service.Title);
            Assert.AreEqual(null, service.DocumentType);
            Assert.AreEqual(null, service.Parameter);
            Assert.AreEqual(viewModel, service.ViewModel);
            Assert.AreEqual(null, service.ParentViewModel);

            service = new TestDialogService();
            commands = new List<UICommand>();
            service.ShowDialog(commands, "title1", "docType", viewModel);
            Assert.AreEqual(commands, service.Commands);
            Assert.AreEqual("title1", service.Title);
            Assert.AreEqual("docType", service.DocumentType);
            Assert.AreEqual(null, service.Parameter);
            Assert.AreEqual(viewModel, service.ViewModel);
            Assert.AreEqual(null, service.ParentViewModel);


            service = new TestDialogService();
            service.ShowDialog(commands, "title3", "docType2", "param", parentViewModel);
            Assert.AreEqual(commands, service.Commands);
            Assert.AreEqual("title3", service.Title);
            Assert.AreEqual("docType2", service.DocumentType);
            Assert.AreEqual("param", service.Parameter);
            Assert.AreEqual(null, service.ViewModel);
            Assert.AreEqual(parentViewModel, service.ParentViewModel);
        }
开发者ID:JustGitHubUser,项目名称:DevExpress.Mvvm.Free,代码行数:35,代码来源:DialogServiceBaseTests.cs

示例15: DefaultViewModelSerializer_NoEncryptedValues

        public void DefaultViewModelSerializer_NoEncryptedValues()
        {
            var oldViewModel = new TestViewModel()
            {
                Property1 = "a",
                Property2 = 4,
                Property3 = new DateTime(2000, 1, 1),
                Property4 = new List<TestViewModel2>()
                {
                    new TestViewModel2() { PropertyA = "t", PropertyB = 15 },
                    new TestViewModel2() { PropertyA = "xxx", PropertyB = 16 }
                },
                Property5 = null
            };
            context.ViewModel = oldViewModel;
            serializer.BuildViewModel(context);
            var result = context.GetSerializedViewModel();
            result = UnwrapSerializedViewModel(result);
            result = WrapSerializedViewModel(result);

            var newViewModel = new TestViewModel();
            context.ViewModel = newViewModel;
            serializer.PopulateViewModel(context, result);

            Assert.AreEqual(oldViewModel.Property1, newViewModel.Property1);
            Assert.AreEqual(oldViewModel.Property2, newViewModel.Property2);
            Assert.AreEqual(oldViewModel.Property3, newViewModel.Property3);
            Assert.AreEqual(oldViewModel.Property4[0].PropertyA, newViewModel.Property4[0].PropertyA);
            Assert.AreEqual(oldViewModel.Property4[0].PropertyB, newViewModel.Property4[0].PropertyB);
            Assert.AreEqual(oldViewModel.Property4[1].PropertyA, newViewModel.Property4[1].PropertyA);
            Assert.AreEqual(oldViewModel.Property4[1].PropertyB, newViewModel.Property4[1].PropertyB);
            Assert.AreEqual(oldViewModel.Property5, newViewModel.Property5);
        }
开发者ID:darilek,项目名称:dotvvm,代码行数:33,代码来源:DefaultViewModelSerializerTests.cs


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