Exemple #1
0
        public void WebContentDispatcherStorageInstanceAddedOnDispose()
        {
            ExecuteTest(() => {
                IContentContainer storage = new InMemoryContainer();

                WebContentDispatcher container = new WebContentDispatcher(storage);
                this.getMystery().AssemblyRegister.setGlobalObject <IContentDispatcher>(container);

                TestContentType c = TestContentType.getARandomTestContentTypeWithoutreference();
                container.Add(c);


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

                Assert.IsTrue(storage.Contains(c));
                this.getMystery().AssemblyRegister.setGlobalObject <IContentDispatcher>(null);
            });
        }
Exemple #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);
            });
        }