public void Test_ThatMyNameChangedEventIsRaised() { string actual = null; Student student = new Student("Ekaterina", 2); student.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { actual = e.PropertyName; }; student.Name = "Katya"; Assert.IsNotNull(actual); Assert.AreEqual("Name", actual); }
public static void Main(string[] args) { Student student = new Student("Ekaterina", 22); student.PropertyChanged += (sender, eventArgs) => { Console.WriteLine( "Property changed: {0} (from {1} to {2})", eventArgs.PropertyName, eventArgs.OldValue, eventArgs.NewValue); }; student.Name = "Katya"; student.Age = 52; }
public void Name_WhenNameIsEmpty_ShouldThrowArgumentNullException() { var personWithEmptyName = new Student(string.Empty, 12); }
public void Person_PersonWithValidNameAndAge_ShouldPassTest() { var personWithValidNameAndAge = new Student("X", 1); }
public void Age_WhenAgeIsNegative_ShouldThrowArgumentOutOfRangeException() { var personWithAgeMoreThan100 = new Student("A", -2); }