public void ArchetypeModel_To_PublishedContentSet() { var contentSet = _archetype.ToPublishedContentSet(); Assert.That(contentSet, Is.Not.Null); Assert.That(contentSet, Is.Not.Empty); Assert.That(contentSet, Is.All.InstanceOf <IPublishedContent>()); }
public static IPublishedContent ToPublishedContent(this ArchetypeFieldsetModel fieldset, ArchetypeModel archetype) { var contentSet = archetype.ToPublishedContentSet(); var first = contentSet .Cast <ArchetypePublishedContent>() .FirstOrDefault(x => x.ArchetypeFieldset == fieldset); return(first ?? new ArchetypePublishedContent(fieldset)); }
public static IPublishedContent ToPublishedContent(this ArchetypeFieldsetModel fieldset, ArchetypeModel archetype) { var contentSet = archetype.ToPublishedContentSet(); var first = contentSet .Cast<ArchetypePublishedContent>() .FirstOrDefault(x => x.ArchetypeFieldset == fieldset); return first ?? new ArchetypePublishedContent(fieldset); }
public void Null_ArchetypeModel_Throws_Exception() { TestDelegate code = () => { ArchetypeModel archetype = null; archetype.ToPublishedContentSet(); }; Assert.Throws <ArgumentNullException>(code); }