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()); }
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); }
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); }
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); }
public LoggingCollectionStub(StringBuilder log) : base(ViewModelStub.Build(), PropertyStub.Build()) { _log = log; }
private static ChangeArgs CreateChangeArgs() { return(ChangeArgs.PropertyChanged(PropertyStub.Build(), ValueStage.ValidatedValue)); }