Пример #1
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();
            });
        }
Пример #2
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);
            });
        }