public void WithSortOrderOnFieldLevel_WhenCalled_ReturnsConfiguredSortOrder(string fieldName, int sortOrder, ID fieldId) { var section = new FakeTemplateSection(new FakeTemplate()); TemplateField field = section.AddField(fieldName, fieldId).WithSortorder(sortOrder); field.Sortorder.Should().Be(sortOrder); }
public void AddField_WhenFieldNameIsGiven_CreatesFieldWithName(ID fieldId, string fieldName) { var section = new FakeTemplateSection(new FakeTemplate()); TemplateField field = section.AddField(fieldName, fieldId); field.Name.Should().Be(fieldName); }
public void WithSortorder_WhenCalled_SetsSectionSortOrder(int sortorder) { TemplateSection section = new FakeTemplateSection(new FakeTemplate()) .WithSortorder(sortorder); section.Sortorder.Should().Be(sortorder); }
public void Constructor_WhenCalledWithoutName_SetsDefaultSectionName() { var template = new FakeTemplate(); TemplateSection section = new FakeTemplateSection(template); section.Name.Should().Be("fakeSection"); }
public void GetFields_WhenNothingWasAdded_ReturnsEmptySequence() { TemplateSection section = new FakeTemplateSection(new FakeTemplate()); var sectionFields = section.GetFields(); sectionFields.Should().BeEmpty(); }
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 GetFieldByName_WhenFieldWasAdded_FindsField(ID fieldId, string fieldName) { var section = new FakeTemplateSection(new FakeTemplate()); TemplateField field = section.AddField(fieldName, fieldId); var actualField = section.ToSitecoreTemplateSection().GetField(fieldName); actualField.Should().BeSameAs(field); }
public void FakeField_ShouldSubstitute_Definition1(string sectionName, string fieldName, ID sectionId, ID fieldId) { var template = new FakeTemplate(); var section = new FakeTemplateSection(template, sectionName, sectionId); TemplateField templateField = new FakeTemplateField(section, fieldName, fieldId); Field field = new FakeField().WithDefinition(templateField); field.Definition.Should().Be(templateField); }
public void GetFields_WhenFieldWasAdded_FindsField(ID fieldId, string fieldName) { var section = new FakeTemplateSection(new FakeTemplate()); section.AddField(fieldName, fieldId); var actualFields = section.ToSitecoreTemplateSection().GetFields(); actualFields .Should().ContainSingle(actualField => actualField.ID == fieldId) .And.HaveCount(1); }
public void WithIcon_WhenCalled_SetsSectionIcon(string sectionIcon) { TemplateSection section = new FakeTemplateSection(new FakeTemplate()).WithIcon(sectionIcon); section.Icon.Should().Be(sectionIcon); }
public void Constructor_WhenCalledWithSectionName_SetsSectionName(string sectionName) { TemplateSection section = new FakeTemplateSection(new FakeTemplate(), sectionName: sectionName); section.Name.Should().Be(sectionName); }
public void Constructor_WhenCalledWithSectionId_SetsSectionId(ID sectionId) { TemplateSection section = new FakeTemplateSection(new FakeTemplate(), sectionId: sectionId); section.ID.Should().Be(sectionId); }
public void Constructor_WhenCalled_CreatesSection() { TemplateSection section = new FakeTemplateSection(); section.Should().NotBeNull(); }