public void DerivesFromViewModelBase() { // Arrange BindableTestClass testClass = new BindableTestClass(); // Assert testClass.GetType().Should().BeDerivedFrom <ViewModelBase>(); }
public void RaisePropertyChangedWhenPropertyValueChanges() { // Arrange BindableTestClass testClass = new BindableTestClass(); testClass.MonitorEvents <INotifyPropertyChanged>(); // Act testClass.Title = "Hello"; testClass.Number = 10; testClass.Name = "Michael"; // Assert testClass.ShouldRaisePropertyChangeFor(x => x.Title); testClass.ShouldRaisePropertyChangeFor(x => x.Number); testClass.ShouldRaisePropertyChangeFor(x => x.Name); }
public void ChangesPropertyValue() { // Arrange const string expectedTitle = "new Title"; const int expectedNumber = 32; const string expectedName = "Andre"; // Act BindableTestClass testClass = new BindableTestClass { Title = expectedTitle, Number = expectedNumber, Name = expectedName }; // Assert testClass.Title.Should().Be(expectedTitle); testClass.Number.Should().Be(expectedNumber); testClass.Name.Should().Be(expectedName); }
public void DoNotRaisePropertyChangedWhenPropertyValuesGetSameValue() { // Arrange const string expectedTitle = "new Title"; const int expectedNumber = 32; const string expectedName = "Andre"; BindableTestClass testClass = new BindableTestClass(expectedTitle, expectedNumber, expectedName); testClass.MonitorEvents <INotifyPropertyChanged>(); // Act testClass.Title = expectedTitle; testClass.Number = expectedNumber; testClass.Name = expectedName; // Assert testClass.ShouldNotRaisePropertyChangeFor(x => x.Title); testClass.ShouldNotRaisePropertyChangeFor(x => x.Number); testClass.ShouldNotRaisePropertyChangeFor(x => x.Name); }