public void Default_Constructor_Set_Setting_To_Default()
        {
            //Assign
            var testUmbracoPropertyAttribute = new UmbracoPropertyAttribute();

            //Act

            //Assert
            testUmbracoPropertyAttribute.Setting.ShouldBeEquivalentTo(UmbracoPropertySettings.Default);
        }
        public void Constructor_Sets_PropertyAlias()
        {
            //Assign
            var testPropertyAlias = "testPropertyAlias";

            //Act
            var testUmbracoPropertyAttribute = new UmbracoPropertyAttribute(testPropertyAlias);

            //Assert
            testUmbracoPropertyAttribute.PropertyAlias.ShouldBeEquivalentTo(testPropertyAlias);
        }
        public void Constructor_Sets_PropertyIdAndPropertyType()
        {
            //Assign
            var testPropertyId = "test";
            var testContentTab = "General Properties";
            var testCodeFirst = true;

            //Act
            var testUmbracoPropertyAttribute = new UmbracoPropertyAttribute("test", UmbracoPropertyType.NotSet);

            //Assert
            testUmbracoPropertyAttribute.CodeFirst.ShouldBeEquivalentTo(testCodeFirst);
            testUmbracoPropertyAttribute.ContentTab.ShouldBeEquivalentTo(testContentTab);
            testUmbracoPropertyAttribute.PropertyAlias.ShouldBeEquivalentTo(testPropertyId);
            testUmbracoPropertyAttribute.PropertyType.ShouldBeEquivalentTo(UmbracoPropertyType.NotSet);
        }
        public void Configure_SettingPropertyMandatory_PropertyMandatoryIsSetOnConfiguration(
            [Values(true)] bool value,
            [Values(true)] bool expected)
        {
            //Assign
            var attr = new UmbracoPropertyAttribute(string.Empty);
            var propertyInfo = typeof(StubClass).GetProperty("DummyProperty");

            attr.PropertyIsMandatory = value;

            //Act
            var result = attr.Configure(propertyInfo) as UmbracoPropertyConfiguration;

            //Assert
            result.Should().NotBeNull();
            result.PropertyIsMandatory.ShouldBeEquivalentTo(expected);
        }
        public void Configure_SettingPropertyDescription_PropertyDescriptionIsSetOnConfiguration(
            [Values("property description")] string value,
            [Values("property description")] string expected)
        {
            //Assign
            var attr = new UmbracoPropertyAttribute(string.Empty);
            var propertyInfo = typeof(StubClass).GetProperty("DummyProperty");

            attr.PropertyDescription = value;

            //Act
            var result = attr.Configure(propertyInfo) as UmbracoPropertyConfiguration;

            //Assert
            result.Should().NotBeNull();
            result.PropertyDescription.ShouldBeEquivalentTo(expected);
        }
        public void Configure_SettingDataType_DataTypeIsSetOnConfiguration(
            [Values(UmbracoPropertyType.TextString)] UmbracoPropertyType value,
            [Values(UmbracoPropertyType.TextString)] UmbracoPropertyType expected)
        {
            //Assign
            var attr = new UmbracoPropertyAttribute(string.Empty);
            var propertyInfo = typeof (StubClass).GetProperty("DummyProperty");

            attr.PropertyType = value;

            //Act
            var result = attr.Configure(propertyInfo) as UmbracoPropertyConfiguration;

            //Assert
            result.Should().NotBeNull();
            result.PropertyType.ShouldBeEquivalentTo(expected);
        }
        public void Configure_SettingSetToDontLoadLazily_SettingsReturnAsDontLoadLazily()
        {
            //Assign
            var attr = new UmbracoPropertyAttribute(string.Empty);
            var propertyInfo = typeof(StubClass).GetProperty("DummyProperty");
            
            attr.Setting = UmbracoPropertySettings.DontLoadLazily;

            //Act
            var result = attr.Configure(propertyInfo) as UmbracoPropertyConfiguration;

            //Assert
            result.Should().NotBeNull();
            result.Setting.ShouldBeEquivalentTo(UmbracoPropertySettings.DontLoadLazily);
        }