public void Construct_PropertyWithoutOverwriteAsSelfNullCheck_ShouldInitializeWithIsSettableFalse()
        {
            MsBuildXmlPropertyImplementation property =
                new MsBuildXmlPropertyImplementation(CreateFromString("<Property>Value</Property>"));

            Assert.IsFalse(property.HasPublicSetter);
        }
        public void Construct_PropertyWithoutConditionAndValueIsDifferentProperty_ShouldInitializeWithIsSettableFalse()
        {
            MsBuildXmlPropertyImplementation property =
                new MsBuildXmlPropertyImplementation(CreateFromString("<Property>$(NotProperty)</Property>"));

            Assert.IsFalse(property.HasPublicSetter);
        }
        public void Construct_PropertyWithoutValue_ShouldInitializePropertyWithNullValue()
        {
            MsBuildXmlPropertyImplementation property =
                new MsBuildXmlPropertyImplementation(CreateFromString("<Property></Property>"));

            Assert.IsNull(property.Value);
        }
        public void Construct_PropertyWithoutTakeOverValue_ShouldInitializeWithIsSettableFalse()
        {
            MsBuildXmlPropertyImplementation property = new MsBuildXmlPropertyImplementation(
                CreateFromString("<Property Condition=\"$(Property)!=''\">$(NotProperty) Value</Property>"));

            Assert.IsFalse(property.HasPublicSetter);
        }
        public void Construct_PropertyWithName_ShouldInitializeProperty()
        {
            MsBuildXmlPropertyImplementation property =
                new MsBuildXmlPropertyImplementation(CreateFromString("<Property></Property>"));

            Assert.AreEqual("Property", property.Name);
        }
        IsPropertyPublicSettable_WithCheckForPropertyIsNotEmptyInConditionAndSetPropertyInContent_ShouldReturnTrue()
        {
            string propertyName      = "TestProperty";
            string propertyCondition = "$(TestProperty) != ''";
            string propertyContent   = "$(TestProperty)";

            Assert.IsTrue(
                MsBuildXmlPropertyImplementation.HasPropertyPublicSetter(propertyName, propertyCondition,
                                                                         propertyContent));
        }
        IsPropertyPublicSettable_WithComplexConditionCheckingPropertyIsNotEmptyAndPropertyValueTakeOverInContent_ShouldReturnTrue()
        {
            string propertyName      = "TestProperty";
            string propertyCondition = "$(OtherProperty) == 'value' AND $(TestProperty) != ''";
            string propertyContent   = "$(TestProperty)";

            Assert.IsTrue(
                MsBuildXmlPropertyImplementation.HasPropertyPublicSetter(propertyName, propertyCondition,
                                                                         propertyContent));
        }
        IsPropertyPublicSettable_WithConditionCheckingSomeOtherPropertiesAndPropertyValueTakeOverInContent_ShouldReturnFalse()
        {
            string propertyName      = "TestProperty";
            string propertyCondition = "$(OtherProperty) == 'value'";
            string propertyContent   = "$(TestProperty)";

            Assert.IsFalse(
                MsBuildXmlPropertyImplementation.HasPropertyPublicSetter(propertyName, propertyCondition,
                                                                         propertyContent));
        }
        public void IsPropertyPublicSettable_WithoutConditionAndContent_ShouldReturnFalse()
        {
            string propertyName      = "TestProperty";
            string propertyCondition = string.Empty;
            string propertyContent   = string.Empty;

            Assert.IsFalse(
                MsBuildXmlPropertyImplementation.HasPropertyPublicSetter(propertyName, propertyCondition,
                                                                         propertyContent));
        }
        public void IsPropertyPublicSettable_WithCheckForPropertyIsEmptyInCondition_ShouldReturnTrue()
        {
            string propertyName      = "TestProperty";
            string propertyCondition = "$(TestProperty) == ''";
            string propertyContent   = string.Empty;

            Assert.IsTrue(
                MsBuildXmlPropertyImplementation.HasPropertyPublicSetter(propertyName, propertyCondition,
                                                                         propertyContent));
        }
        public void IsPropertyPublicSettable_WithCheckForOtherPropertyAndSetOtherPropertyValue_ShouldReturnTrue()
        {
            string propertyName      = "TestProperty";
            string propertyCondition = "$(OtherProperty) != ''";
            string propertyContent   = "$(OtherProperty)";

            Assert.IsTrue(
                MsBuildXmlPropertyImplementation.HasPropertyPublicSetter(propertyName, propertyCondition,
                                                                         propertyContent));
        }
        IsPropertyPublicSettable_WithCheckForPropertyIsNotEmptyInConditionAndNoPropertyValueTakeOverInContent_ShouldReturnFalse()
        {
            string propertyName      = "TestProperty";
            string propertyCondition = "$(TestProperty) != ''";
            string propertyContent   = "SomeOtherValues $(OtherProperty)";

            Assert.IsFalse(
                MsBuildXmlPropertyImplementation.HasPropertyPublicSetter(propertyName, propertyCondition,
                                                                         propertyContent));
        }
示例#13
0
        public void HasPropertyPublicSetter_WithEmptyConditionAndPropertyNameAsContent_ReturnTrue()
        {
            string propertyContent   = "$(Test)";
            string propertyCondition = null;
            string propertyName      = "Test";

            Assert.IsTrue(
                MsBuildXmlPropertyImplementation.HasPropertyPublicSetter(propertyName, propertyCondition,
                                                                         propertyContent),
                "Property without condition and self set in content should return true");
        }
示例#14
0
        public void HasPropertyPublicSetter_WithNullContentAndNullCondition_ReturnTrue()
        {
            string propertyContent   = null;
            string propertyCondition = null;
            string propertyName      = "Test";

            Assert.IsFalse(
                MsBuildXmlPropertyImplementation.HasPropertyPublicSetter(propertyName, propertyCondition,
                                                                         propertyContent),
                "Property without content and condition should return false");
        }
 public void Construct_WithNullInput_ShouldThrowException()
 {
     MsBuildXmlPropertyImplementation property = new MsBuildXmlPropertyImplementation(null);
 }