Ejemplo n.º 1
0
        private void DoAssert(
            DefaultPublishedMediaStore.DictionaryPublishedContent dicDoc,
            int idVal               = 1234,
            int templateIdVal       = 333,
            int sortOrderVal        = 44,
            string urlNameVal       = "testing",
            string nodeTypeAliasVal = "myType",
            int nodeTypeIdVal       = 22,
            string writerNameVal    = "Shannon",
            string creatorNameVal   = "Shannon2",
            int writerIdVal         = 33,
            int creatorIdVal        = 44,
            string pathVal          = "1,2,3,4,5",
            DateTime?createDateVal  = null,
            DateTime?updateDateVal  = null,
            int levelVal            = 3,
            int parentIdVal         = 321)
        {
            if (!createDateVal.HasValue)
            {
                createDateVal = DateTime.Parse("2012-01-02");
            }
            if (!updateDateVal.HasValue)
            {
                updateDateVal = DateTime.Parse("2012-01-03");
            }

            DoAssert((IPublishedContent)dicDoc, idVal, templateIdVal, sortOrderVal, urlNameVal, nodeTypeAliasVal, nodeTypeIdVal, writerNameVal,
                     creatorNameVal, writerIdVal, creatorIdVal, pathVal, createDateVal, updateDateVal, levelVal);

            //now validate the parentId that has been parsed, this doesn't exist on the IPublishedContent
            Assert.AreEqual(parentIdVal, dicDoc.ParentId);
        }
Ejemplo n.º 2
0
        private DefaultPublishedMediaStore.DictionaryPublishedContent GetDictionaryDocument(
            string idKey            = "id",
            string templateKey      = "template",
            string nodeNameKey      = "nodeName",
            string nodeTypeAliasKey = "nodeTypeAlias",
            string pathKey          = "path",
            int idVal       = 1234,
            int parentIdVal = 321,
            IEnumerable <IPublishedContent> children = null)
        {
            if (children == null)
            {
                children = new List <IPublishedContent>();
            }
            var dicDoc = new DefaultPublishedMediaStore.DictionaryPublishedContent(
                //the dictionary
                GetDictionary(idVal, parentIdVal, idKey, templateKey, nodeNameKey, nodeTypeAliasKey, pathKey),
                //callback to get the parent
                d => new DefaultPublishedMediaStore.DictionaryPublishedContent(
                    GetDictionary(parentIdVal, -1, idKey, templateKey, nodeNameKey, nodeTypeAliasKey, pathKey),
                    //there is no parent
                    a => null,
                    //we're not going to test this so ignore
                    a => new List <IPublishedContent>(),
                    (dd, a) => dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(a)),
                    false),
                //callback to get the children
                d => children,
                (dd, a) => dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(a)),
                false);

            return(dicDoc);
        }