public RaiseEvent ( string description, System.DateTime when, IEnumerable |
||
description | string | Event description |
when | System.DateTime | Date when the event occured |
topicIds | IEnumerable |
A list of the topic ids that classify this event |
eventProperties | object>.Dictionary | A name value collection of all event properties |
return | void |
public void TestEventData() { var storeId = Guid.NewGuid().ToString(); var eventService = new EventFeedService(storeId); // create a topic first that can be subscribed to, this topic could have been 'found' by search or be // a well known topic. eventService.AssertTopic(new Uri("http://www.brightstardb.com/topics/34"), "Topic 34", "A very important topic"); eventService.AssertSubscriber("domain\\bob", new List<Uri>() { new Uri("http://www.brightstardb.com/topics/34") }); eventService.RaiseEvent("Bob created document Y", DateTime.UtcNow, new List<string> { "http://www.brightstardb.com/topics/34" }, new Dictionary<string, object> { {"Type", "DocumentEvent"},{ "DocumentUrl", "http://sharepoint.brightstardb.com/file1.docx"}}); var events = eventService.GetTopicTimeline("http://www.brightstardb.com/topics/34", DateTime.MinValue); Assert.AreEqual(1, events.Count()); // get event var ev = events.ToList()[0]; var eventData = eventService.GetEventData(ev); Assert.AreEqual("http://sharepoint.brightstardb.com/file1.docx", eventData.DocumentUrl.FirstOrDefault()); }
public void TestRaiseEvent() { var storeId = Guid.NewGuid().ToString(); var eventService = new EventFeedService(storeId); // create a topic first that can be subscribed to, this topic could have been 'found' by search or be // a well known topic. eventService.AssertTopic(new Uri("http://www.brightstardb.com/topics/34"), "Topic 34", "A very important topic"); eventService.AssertSubscriber("domain\\bob", new List<Uri>() { new Uri("http://www.brightstardb.com/topics/34") }); eventService.RaiseEvent("Bob created document Y", DateTime.UtcNow, new List<string>() { "http://www.brightstardb.com/topics/34" }); // use a raw context to check it exist var ctx = GetContext(storeId); Assert.AreEqual(1, ctx.Topics.Count()); Assert.AreEqual(new Uri("http://www.brightstardb.com/topics/34"), ctx.Topics.ToList()[0].Id); Assert.AreEqual(1, ctx.Events.Count()); var ev = ctx.Events.ToList()[0]; Assert.AreEqual(1, ev.Topics.Count()); Assert.AreEqual("http://www.brightstardb.com/topics/34", ev.Topics.ToList()[0].Id); }
public void TestRemoveInterest() { var storeId = Guid.NewGuid().ToString(); var eventService = new EventFeedService(storeId); // create a topic first that can be subscribed to, this topic could have been 'found' by search or be // a well known topic. eventService.AssertTopic(new Uri("http://www.brightstardb.com/topics/34"), "Topic 34", "A very important topic"); eventService.AssertTopic(new Uri("http://www.brightstardb.com/topics/33"), "Topic 33", "A very important topic"); eventService.AssertSubscriber("domain\\bob", new List<Uri>() { new Uri("http://www.brightstardb.com/topics/34") }); eventService.RegisterInterest("domain\\bob", "http://www.brightstardb.com/topics/33"); eventService.RaiseEvent("Bob created document Y", DateTime.UtcNow, new List<string>() { "http://www.brightstardb.com/topics/33" }); var events = eventService.GetSubscriberTimeline("domain\\bob", DateTime.MinValue); Assert.AreEqual(1, events.Count()); // remove interest eventService.RemoveInterest("domain\\bob", "http://www.brightstardb.com/topics/33"); eventService.RaiseEvent("Bob created document Y", DateTime.UtcNow, new List<string>() { "http://www.brightstardb.com/topics/33" }); events = eventService.GetSubscriberTimeline("domain\\bob", DateTime.MinValue); Assert.AreEqual(1, events.Count()); }