示例#1
0
        public void PropertyChangedInConstructorSerializes()
        {
            // Concrete3's constructor sets Example2 and Example3 to null. This means that their _Accessed fields will be true.
            // When we deserialize ContainerWithAbstract1, we also deserialize Concrete3. If we did not call FreeInMemoryObjects,
            // then when we access Example2, it would appear that no deserialization is necessary, and Example2 will stay at its null value.
            // Both of the following examples fail without FreeInMemoryObjects().

            var concrete = new Concrete3()
            {
                Example2 = GetTypicalExample(),
                Example3 = GetTypicalExample()
            };
            var concrete2 = concrete.CloneLazinatorTyped();

            concrete2.Example2.Should().NotBeNull();
            concrete2.Example3.Should().NotBeNull();

            ContainerWithAbstract1 c = new ContainerWithAbstract1()
            {
                AbstractProperty = new Concrete3()
                {
                    Example2 = GetTypicalExample(), Example3 = GetTypicalExample()
                }
            };
            var c2 = c.CloneLazinatorTyped();
            var c2_abstractProperty = (c2.AbstractProperty as Concrete3);

            c2_abstractProperty.Example2.Should().NotBeNull();
            c2_abstractProperty.Example3.Should().NotBeNull();
        }
示例#2
0
        public void Editable_ConcreteNoId_NoExceptions()
        {
            //Assign
            global::Sitecore.Context.Site = global::Sitecore.Configuration.Factory.GetSite("website");

            Concrete3 item = _service.GetItem <Concrete3>(_editablePath);
            GlassHtml html = new GlassHtml(_service);


            //Act
            html.Editable(item, x => x.MissingField);
        }
示例#3
0
 private void LazinateMyUnofficialObject()
 {
     if (LazinatorMemoryStorage.Length == 0)
     {
         _MyUnofficialObject = null;
     }
     else
     {
         LazinatorMemory childData = GetChildSlice(LazinatorMemoryStorage, _MyUnofficialObject_ByteIndex, _MyUnofficialObject_ByteLength, null);
         _MyUnofficialObject = DeserializationFactory.Instance.CreateBaseOrDerivedType(1037, (c, p) => new Concrete3(c, p), childData, this);
     }
     _MyUnofficialObject_Accessed = true;
 }
示例#4
0
        public void TestPropertyOfInterface()
        {
            Concrete2 c2        = new Concrete2();
            Concrete3 c3        = new Concrete3();
            Container container = new Container();

            Simulation sim = new Simulation();

            sim.Children.Add(container);
            Simulations sims = new Simulations();

            sims.Children.Add(sim);

            ILocator locator = sims.GetLocatorService(sim);

            container.Value = c2;
            Assert.AreEqual(2, locator.Get("[Container].Value.X"));
            container.Value = c3;
            Assert.AreEqual(3, locator.Get("[Container].Value.X"));
        }
示例#5
0
 public Concrete2(Concrete3 c3)
 {
 }