コード例 #1
0
        public void WebContentDispatcherContainsTest()
        {
            ExecuteTest(() => {
                WebContentDispatcher container = new WebContentDispatcher(new InMemoryContainer());
                List <IContent> contents       = new List <IContent>(from int i in Enumerable.Range(0, rnd.Next(10) + 2)
                                                                     select TestContentType.getARandomTestContentType(enforce_a_reference: false));

                Assert.IsFalse(container.Contains(contents[rnd.Next(contents.Count - 1)]));

                container.AddContents(contents);

                Assert.IsTrue(container.Contains(contents[rnd.Next(contents.Count - 1)]));
                container.Dispose();
            });
        }
コード例 #2
0
        public void WebContentDispatcherWhenRemovedStorageStilHaveIt()
        {
            ExecuteTest(() => {
                IContentContainer storage      = new InMemoryContainer();
                WebContentDispatcher container = new WebContentDispatcher(storage);
                this.setGlobalObject <IContentDispatcher>(container);

                TestContentType c = TestContentType.getARandomTestContentType(enforce_a_reference: false);
                storage.Add(c);

                Assert.IsTrue(container.Remove(c));

                Assert.IsFalse(container.Contains(c));
                Assert.IsTrue(storage.Contains(c));
                container.Dispose();

                this.setGlobalObject <IContentDispatcher>(null);
            });
        }