示例#1
0
        public void AccessModifiers_PrivatePropertiesWriteToField()
        {
            //Assign

            MiscFixtureNS.AccessModifiersPrivate target = null;
            Guid id = new Guid("{6FEE384F-3A05-4520-A80C-F80A6A454608}");

            Item item = _db.GetItem(new ID(id));

            using (new SecurityDisabler())
            {
                item.Editing.BeginEdit();

                item["SingleLineText"] = string.Empty;

                target = new MiscFixtureNS.AccessModifiersPrivate();
                target.GetPrivateSingleLineText = "private test";

                _sitecore.WriteToItem(target, item);

                Assert.AreEqual("private test", item["SingleLineText"]);

                item.Editing.CancelEdit();
            }
        }
        public void AccessModifiers_PrivatePropertiesWriteToField()
        {
            //Assign

            MiscFixtureNS.AccessModifiersPrivate target = null;
            Guid id = new Guid("{6FEE384F-3A05-4520-A80C-F80A6A454608}");

            Item item = _db.GetItem(new ID(id));

            using (new SecurityDisabler())
            {
                item.Editing.BeginEdit();

                item["SingleLineText"] = string.Empty;

                target = new MiscFixtureNS.AccessModifiersPrivate();
                target.GetPrivateSingleLineText = "private test";

                _sitecore.WriteToItem(target, item);

                Assert.AreEqual("private test", item["SingleLineText"]);

                item.Editing.CancelEdit();
            }
        }