예제 #1
0
        public void ViewModelPropertyChanged_SetsOldAndNewItems()
        {
            var property = PropertyStub.Build();
            var newValue = ViewModelStub.Build();
            var args     = ChangeArgs.ViewModelPropertyChanged(property, ValueStage.ValidatedValue, null, newValue);

            CollectionAssert.AreEqual(new IViewModel[0], args.OldItems.ToArray());
            CollectionAssert.AreEqual(new IViewModel[] { newValue }, args.NewItems.ToArray());
        }
예제 #2
0
        public void ViewModelPropertyChanged_SetsChangeTypeAndChangedPathToProperty()
        {
            var property = PropertyStub.Build();
            var args     = ChangeArgs.ViewModelPropertyChanged(property, ValueStage.Value, null, null);

            Assert.AreEqual(ChangeType.PropertyChanged, args.ChangeType);
            Assert.AreEqual(ValueStage.Value, args.Stage);
            DomainAssert.AreEqual(Path.Empty.Append(property), args.ChangedPath);
        }
예제 #3
0
        public void ValidationStateChange_SetsChangeTypeAndChangedPath()
        {
            var args = ChangeArgs.ValidationResultChanged();

            Assert.AreEqual(ChangeType.ValidationResultChanged, args.ChangeType);
            DomainAssert.AreEqual(Path.Empty, args.ChangedPath);

            var property = PropertyStub.Build();

            args = ChangeArgs.ValidationResultChanged(property, ValueStage.ValidatedValue);
            Assert.AreEqual(ValueStage.ValidatedValue, args.Stage);
            Assert.AreEqual(ChangeType.ValidationResultChanged, args.ChangeType);
            DomainAssert.AreEqual(Path.Empty.Append(property), args.ChangedPath);
        }
예제 #4
0
        public void HandleChange_WithValidationResultChangedOfDescendantProperty_DoesNotUpdateCachedResults()
        {
            var vm = new TestVM();

            var descendantArgs = ChangeArgs
                                 .ValidationResultChanged(PropertyStub.Build(), ValueStage.ValidatedValue)
                                 .PrependViewModel(ViewModelStub.Build())
                                 .PrependViewModel(vm);

            vm.FirstPropertyResultSetup = CreateValidationResult("Irrelevant property error");
            vm.CallHandleChangeWith(descendantArgs);

            AssertBehaviorResults(vm, ExpectedResults.AllValid);
        }
예제 #5
0
 public LoggingCollectionStub(StringBuilder log)
     : base(ViewModelStub.Build(), PropertyStub.Build())
 {
     _log = log;
 }
예제 #6
0
 private static ChangeArgs CreateChangeArgs()
 {
     return(ChangeArgs.PropertyChanged(PropertyStub.Build(), ValueStage.ValidatedValue));
 }