Пример #1
0
        public void WebContentDispatcherRetriveFromPermanetTest()
        {
            ExecuteTest(() => {
                IContentContainer storage      = new InMemoryContainer();
                WebContentDispatcher container = new WebContentDispatcher(storage);

                TestContentType c = TestContentType.getARandomTestContentType(enforce_a_reference: false);
                storage.Add(c);
                Guid guid = c.guid;
                Assert.IsNotNull(container.GetContent <TestContentType>(c.guid));
                container.Dispose();
            });
        }
Пример #2
0
        public void WebContentDispatcherStorageHaveDifferentInstaceButSameProperties()
        {
            ExecuteTest(() => {
                IContentContainer storage      = new InMemoryContainer();
                WebContentDispatcher container = new WebContentDispatcher(storage);

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

                Assert.AreNotSame(container.GetContent <TestContentType>(guid),
                                  storage.GetContent <TestContentType>(guid));


                Assert.IsTrue(container.GetContent <TestContentType>(guid).samePropertiesValue(storage.GetContent <TestContentType>(guid)));
                container.Dispose();
            });
        }
Пример #3
0
        public void WebContentDispatcherStorageInstanceDeletedOnDispose()
        {
            ExecuteTest(() => {
                IContentContainer storage = new InMemoryContainer();

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

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

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

                Assert.IsFalse(storage.Contains(c));
                this.getMystery().AssemblyRegister.setGlobalObject <IContentDispatcher>(null);
            });
        }
Пример #4
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);
            });
        }
Пример #5
0
        public void WebContentDispatcherStorageInstanceUpdateOnDispose()
        {
            ExecuteTest(() => {
                IContentContainer storage      = new InMemoryContainer();
                string test_value              = "ciao";
                WebContentDispatcher container = new WebContentDispatcher(storage);
                this.getMystery().AssemblyRegister.setGlobalObject <IContentDispatcher>(container);

                TestContentType c = TestContentType.getARandomTestContentTypeWithoutreference();
                storage.Add(c);
                Guid guid = c.guid;
                TestContentType in_request = container.GetContent <TestContentType>(guid);
                in_request.a_string        = test_value;
                Assert.AreNotEqual(test_value, c.a_string);
                container.Dispose();
                c = storage.GetContent <TestContentType>(guid);
                Assert.AreEqual(test_value, c.a_string);
                this.getMystery().AssemblyRegister.setGlobalObject <IContentDispatcher>(null);
            });
        }