public void RemovesListItemMessageNotification() { BaseClassMockWithChildren obj = ObjectUtilities.CreateInstanceWithRandomValues <BaseClassMockWithChildren>(); obj.ChangeMessage(); MessengerMonitor <BaseClassMockWithChildren> monitor = new MessengerMonitor <BaseClassMockWithChildren>(obj); while (obj.ChildCollection.Count > 0) { BaseClassMock child = obj.ChildCollection.Last(); obj.ChildCollection.Remove(child); child.ChangeMessage(RandomUtilities.GetRandomString(obj.Message)); Assert.AreNotEqual(child.Message, obj.Message); monitor.AssertMessageCount(0, false); } while (obj.ChildCollectionReadOnly.Count > 0) { BaseClassMock child = obj.ChildCollectionReadOnly.Last(); obj.ChildCollectionReadOnly.Remove(child); child.ChangeMessage(RandomUtilities.GetRandomString(obj.Message)); Assert.AreNotEqual(child.Message, obj.Message); monitor.AssertMessageCount(0, false); } }
public void RaisesListItemMessages() { BaseClassMockWithChildren obj = ObjectUtilities.CreateInstanceWithRandomValues <BaseClassMockWithChildren>(); MessengerMonitor <BaseClassMockWithChildren> monitor = new MessengerMonitor <BaseClassMockWithChildren>(obj); int count = 0; foreach (BaseClassMock item in obj.ChildCollection) { string message = RandomUtilities.GetRandomString(item.Message); item.ChangeMessage(message); count++; monitor.AssertMessageNotification(message, false); monitor.AssertMessageCount(count, false); } monitor.ClearNotifications(); count = 0; foreach (BaseClassMock item in obj.ChildCollectionReadOnly) { string message = RandomUtilities.GetRandomString(item.Message); item.ChangeMessage(message); count++; monitor.AssertMessageNotification(message, false); monitor.AssertMessageCount(count, false); } }
public void RaisesChildMessages() { BaseClassMockWithChildren obj = ObjectUtilities.CreateInstanceWithRandomValues <BaseClassMockWithChildren>(); MessengerMonitor <BaseClassMockWithChildren> monitor = new MessengerMonitor <BaseClassMockWithChildren>(obj); for (int i = 0; i < new Random().Next(5, 20); i++) { string message = RandomUtilities.GetRandomString(obj.Child.Message); obj.Child.ChangeMessage(message); monitor.AssertMessageNotification(message, false); monitor.AssertMessageCount(i + 1, false); } monitor.ClearNotifications(); for (int i = 0; i < new Random().Next(5, 20); i++) { string message = RandomUtilities.GetRandomString(obj.ChildReadOnly.Message); obj.ChildReadOnly.ChangeMessage(message); monitor.AssertMessageNotification(message, false); monitor.AssertMessageCount(i + 1, false); } monitor.ClearNotifications(); for (int i = 0; i < new Random().Next(5, 20); i++) { string message = RandomUtilities.GetRandomString(obj.Message); obj.Child.ChangeMessage(message); obj.ChildReadOnly.ChangeMessage(message); monitor.AssertMessageNotification(message, false); monitor.AssertMessageCount(i + 1, false); } }
public void RaisesMessages() { BaseClassMockWithChildren obj = new BaseClassMockWithChildren(); MessengerMonitor <BaseClassMockWithChildren> monitor = new MessengerMonitor <BaseClassMockWithChildren>(obj); for (int i = 0; i < new Random().Next(5, 20); i++) { string message = RandomUtilities.GetRandomString(obj.Message); obj.ChangeMessage(message); monitor.AssertMessageNotification(message, false); monitor.AssertMessageCount(i + 1, false); } }
public void RemovesChildMessageNotification() { BaseClassMockWithChildren obj = ObjectUtilities.CreateInstanceWithRandomValues <BaseClassMockWithChildren>(); obj.ChangeMessage(); MessengerMonitor <BaseClassMockWithChildren> monitor = new MessengerMonitor <BaseClassMockWithChildren>(obj); BaseClassMock child = obj.Child; obj.Child = new BaseClassMock(); for (int i = 0; i < new Random().Next(5, 20); i++) { string message = RandomUtilities.GetRandomString(obj.Message); child.ChangeMessage(message); Assert.AreNotEqual(message, obj.Message); } monitor.AssertMessageCount(0, false); }