AssertTopic() public method

public AssertTopic ( Uri topicId, string label, string description ) : void
topicId System.Uri
label string
description string
return void
        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);
        }
        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 TestAssertSubscriber()
        {
            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") });

            // 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.Subscribers.Count());
            var sub = ctx.Subscribers.ToList()[0];

            Assert.AreEqual(1, sub.Topics.Count());
            Assert.AreEqual("http://www.brightstardb.com/topics/34", sub.Topics.ToList()[0].Id);
        }
        public void TestTopicTimeline()
        {
            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" });

            var events = eventService.GetTopicTimeline("http://www.brightstardb.com/topics/34", DateTime.MinValue);
            Assert.AreEqual(1, events.Count());
        }