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); } }