예제 #1
0
        public void Test_EqualWhen_DoesNotChange()
        {
            // Arrange.
            Property <int> property = Property.New(this, x => x.IntValue, OnPropertyChanged)
                                      .EqualWhen((older, newer) => older > newer);

            property.Value = -1;

            // Act/Assert.
            AssertThat.PropertyDoesNotChange(this,
                                             x => x.IntValue,
                                             () => property.Value = -2);
        }
        public void Test_Save_UnsubscribesFromCollectionChanges()
        {
            // Arrange.
            recentFiles.SetupGet(rf => rf.Count)
            .Returns(0);

            // Act.
            viewModel.Save();

            // Assert.
            AssertThat.PropertyDoesNotChange(viewModel,
                                             p => p.CanClearRecentFiles,
                                             () => recentFiles.As <INotifyCollectionChanged>()
                                             .Raise(rf => rf.CollectionChanged += null,
                                                    new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)));
        }