Beispiel #1
0
        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);
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
        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());
        }
Beispiel #4
0
        public void TestAssertTopic()
        {
            var storeId      = Guid.NewGuid().ToString();
            var eventService = new EventFeedService(storeId);

            eventService.AssertTopic(new Uri("http://www.brightstardb.com/topics/34"), "Topic 34", "A very important topic");

            // 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);
        }
Beispiel #5
0
 public void TestCreateServiceInstance()
 {
     var eventService = new EventFeedService(Guid.NewGuid().ToString());
 }