public void WithFullName_WhenCalled_ConfiguresTemplateEngineToFindTemplateByFullName(string fullName) { FakeTemplate template = new FakeTemplate().WithFullName(fullName); var foundByFullName = template.TemplateEngine.GetTemplate(fullName); foundByFullName.Should().Be(template.ToSitecoreTemplate()); }
public void Constructor_WhenCalledWithFakeTemplate_SetsSectionTemplateToParent(ID templateId) { var template = new FakeTemplate(templateId: templateId); TemplateSection section = new FakeTemplateSection(template); section.Template.Should().Be(template.ToSitecoreTemplate()); }
public void AddField_WhenCalled_AddsSection(string fieldName, string sectionName, ID fieldId) { var fakeTemplate = new FakeTemplate(); fakeTemplate.AddField(sectionName, fieldName, fieldId); Template template = fakeTemplate.ToSitecoreTemplate(); template.GetSections().Should().ContainSingle(section => section.Name == sectionName); }
public void AddField_WhenCalled_AddsFieldToTemplate(string fieldName, string sectionName, ID fieldId) { var fakeTemplate = new FakeTemplate(); fakeTemplate.AddField(sectionName, fieldName, fieldId); Template template = fakeTemplate.ToSitecoreTemplate(); template.GetFields().Should().ContainSingle(field => field.ID == fieldId); }
public void AddSection_WhenCalled_AddsSectionToParentTemplate(string name, ID id) { var fakeTemplate = new FakeTemplate(); fakeTemplate.AddSection(name, id); Template template = fakeTemplate.ToSitecoreTemplate(); template.GetSections().Should().ContainSingle(); }
public void AddField_WhenCalledTwoTimesForSameSection_CreatesOnlyOneSection(string unoField, string dosField, ID unoFieldId, ID dosFieldId, string sectionName) { var fakeTemplate = new FakeTemplate(); fakeTemplate.AddField(sectionName, unoField, unoFieldId); fakeTemplate.AddField(sectionName, dosField, dosFieldId); Template template = fakeTemplate.ToSitecoreTemplate(); template.GetSections().Should().ContainSingle(); }
public void AddSection_WhenCalled_AllowsGetSectionToBeFoundById(string name, ID id) { var fakeTemplate = new FakeTemplate(); TemplateSection section = fakeTemplate.AddSection(name, id); Template template = fakeTemplate.ToSitecoreTemplate(); var foundSection = template.GetSection(id); foundSection.Should().Be(section); }
public void AddField_WhenCalledForDifferentSections_AddsFieldsToDistinctSections(string unoField, string dosField, ID unoFieldId, ID dosFieldId, string unoSectionName, string dosSectionName) { var fakeTemplate = new FakeTemplate(); fakeTemplate.AddField(unoSectionName, unoField, unoFieldId); fakeTemplate.AddField(dosSectionName, dosField, dosFieldId); Template template = fakeTemplate.ToSitecoreTemplate(); template.GetSections() .Should() .ContainSingle(section => section.GetField(unoFieldId) != null, nameof(unoSectionName)) .And .ContainSingle(section => section.GetField(dosFieldId) != null, nameof(dosSectionName)); }
public void AddField_WhenCalledTwoTimesForSameSection_AddsToSameSection(string unoField, string dosField, ID unoFieldId, ID dosFieldId, string sectionName) { var fakeTemplate = new FakeTemplate(); fakeTemplate.AddField(sectionName, unoField, unoFieldId); fakeTemplate.AddField(sectionName, dosField, dosFieldId); Template template = fakeTemplate.ToSitecoreTemplate(); var section = template.GetSection(sectionName); section.GetFields() .Should().HaveCount(2) .And.ContainSingle(f => f.ID == unoFieldId, nameof(unoFieldId)) .And.ContainSingle(f => f.ID == dosFieldId, nameof(dosFieldId)); }