示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        public void WithSortorder_WhenCalled_SetsSectionSortOrder(int sortorder)
        {
            TemplateSection section = new FakeTemplateSection(new FakeTemplate())
                                      .WithSortorder(sortorder);

            section.Sortorder.Should().Be(sortorder);
        }
示例#4
0
        public void Constructor_WhenCalledWithoutName_SetsDefaultSectionName()
        {
            var             template = new FakeTemplate();
            TemplateSection section  = new FakeTemplateSection(template);

            section.Name.Should().Be("fakeSection");
        }
示例#5
0
        public void GetFields_WhenNothingWasAdded_ReturnsEmptySequence()
        {
            TemplateSection section = new FakeTemplateSection(new FakeTemplate());

            var sectionFields = section.GetFields();

            sectionFields.Should().BeEmpty();
        }
示例#6
0
        public void Constructor_WhenCalledWithFakeTemplate_SetsSectionTemplateToParent(ID templateId)
        {
            var template = new FakeTemplate(templateId: templateId);

            TemplateSection section = new FakeTemplateSection(template);

            section.Template.Should().Be(template.ToSitecoreTemplate());
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }
示例#9
0
        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);
        }
示例#10
0
        public void WithIcon_WhenCalled_SetsSectionIcon(string sectionIcon)
        {
            TemplateSection section = new FakeTemplateSection(new FakeTemplate()).WithIcon(sectionIcon);

            section.Icon.Should().Be(sectionIcon);
        }
示例#11
0
        public void Constructor_WhenCalledWithSectionName_SetsSectionName(string sectionName)
        {
            TemplateSection section = new FakeTemplateSection(new FakeTemplate(), sectionName: sectionName);

            section.Name.Should().Be(sectionName);
        }
示例#12
0
        public void Constructor_WhenCalledWithSectionId_SetsSectionId(ID sectionId)
        {
            TemplateSection section = new FakeTemplateSection(new FakeTemplate(), sectionId: sectionId);

            section.ID.Should().Be(sectionId);
        }
示例#13
0
        public void Constructor_WhenCalled_CreatesSection()
        {
            TemplateSection section = new FakeTemplateSection();

            section.Should().NotBeNull();
        }