public void Notification_Message1()
{
Subscription.Subscribe(Subscriber1, TestRoot, NotificationFrequency.Immediately, "en", TESTSITEPATH, TESTSITEURL);
Subscription.Subscribe(Subscriber2, TestRoot, NotificationFrequency.Immediately, "en", TESTSITEPATH, TESTSITEURL);
TestRoot.Security.SetPermission(Subscriber1, true, PermissionType.OpenMinor, ContentRepository.Storage.Security.PermissionValue.Allow);
TestRoot.Security.SetPermission(Subscriber2, true, PermissionType.Open, ContentRepository.Storage.Security.PermissionValue.Allow);
var content1 = Content.CreateNew("Car", TestRoot, "car_msg1");
var content2 = Content.CreateNew("Car", TestRoot, "car_msg2");
((GenericContent)content1.ContentHandler).VersioningMode = ContentRepository.Versioning.VersioningType.MajorAndMinor;
((GenericContent)content2.ContentHandler).VersioningMode = ContentRepository.Versioning.VersioningType.MajorAndMinor;
content1.Save();
content2.Save();
Event.CreateAndSave("/Root/_NotificationTests/car_msg1", 1, 1, NotificationType.MinorVersionModified, "\\Administrator");
Event.CreateAndSave("/Root/_NotificationTests/car_msg1", 1, 1, NotificationType.MinorVersionModified, "\\Administrator");
Event.CreateAndSave("/Root/_NotificationTests/car_msg2", 1, 1, NotificationType.MinorVersionModified, "\\Administrator");
Event.CreateAndSave("/Root/_NotificationTests/car_msg1", 1, 1, NotificationType.MinorVersionModified, "\\Administrator");
Event.CreateAndSave("/Root/_NotificationTests/car_msg2", 1, 1, NotificationType.MinorVersionModified, "\\Administrator");
Event.CreateAndSave("/Root/_NotificationTests/car_msg1", 1, 1, NotificationType.MinorVersionModified, "\\Administrator");
Event.CreateAndSave("/Root/_NotificationTests/car_msg1", 1, 1, NotificationType.MajorVersionModified, "\\Administrator");
Event.CreateAndSave("/Root/_NotificationTests/car_msg1", 1, 1, NotificationType.MinorVersionModified, "\\Administrator");
Event.CreateAndSave("/Root/_NotificationTests/car_msg1", 1, 1, NotificationType.MajorVersionModified, "\\Administrator");
Event.CreateAndSave("/Root/_NotificationTests/car_msg2", 1, 1, NotificationType.MajorVersionModified, "\\Administrator");
var subscriptions = NotificationHandlerAccessor.CollectEventsPerSubscription(NotificationFrequency.Immediately, DateTime.Now).ToArray();
Assert.IsTrue(subscriptions.Length == 2, "#1");
if (subscriptions[0].UserId != Subscriber1.Id)
Assert.Inconclusive();
if (subscriptions[1].UserId != Subscriber2.Id)
Assert.Inconclusive();
var events0 = subscriptions[0].RelatedEvents.ToArray();
Assert.IsTrue(events0.Length == 4, String.Format("#11: events1.Length: {0}, expected: 4", events0.Length));
Assert.IsTrue(events0[0].NotificationType == NotificationType.MinorVersionModified, "#3");
Assert.IsTrue(events0[0].ContentPath == "/Root/_NotificationTests/car_msg2", "#4");
Assert.IsTrue(events0[1].NotificationType == NotificationType.MinorVersionModified, "#5");
Assert.IsTrue(events0[1].ContentPath == "/Root/_NotificationTests/car_msg1", "#6");
Assert.IsTrue(events0[2].NotificationType == NotificationType.MajorVersionModified, "#7");
Assert.IsTrue(events0[2].ContentPath == "/Root/_NotificationTests/car_msg1", "#8");
Assert.IsTrue(events0[3].NotificationType == NotificationType.MajorVersionModified, "#9");
Assert.IsTrue(events0[3].ContentPath == "/Root/_NotificationTests/car_msg2", "#10");
var events1 = subscriptions[1].RelatedEvents.ToArray();
Assert.IsTrue(events1.Length == 2, String.Format("#11: events1.Length: {0}, expected: 2", events1.Length));
Assert.IsTrue(events1[0].NotificationType == NotificationType.MajorVersionModified, "#12");
Assert.IsTrue(events1[0].ContentPath == "/Root/_NotificationTests/car_msg1", "#13");
Assert.IsTrue(events1[1].NotificationType == NotificationType.MajorVersionModified, "#14");
Assert.IsTrue(events1[1].ContentPath == "/Root/_NotificationTests/car_msg2", "#15");
}
[TestMethod]