public void ShouldSerializeValueReturnsFalseWhenParameterValueIsSameAsDefault()
        {
            var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);

            target.SetValue(this.parent, default(int));
            Assert.IsFalse(target.ShouldSerializeValue(this.parent));
        }
        public void SetValueStoresValueInProjectItemMetadata()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            target.SetValue(this.parent, ParameterValue);
            Assert.AreEqual(ParameterValue, this.projectItem.Metadata[ParameterName]);
        }
        public void ShouldSerializeValueReturnsTrueWhenParameterValueIsDifferentFromDefault()
        {
            var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);

            target.SetValue(this.parent, int.Parse(ParameterValue, CultureInfo.InvariantCulture));
            Assert.IsTrue(target.ShouldSerializeValue(this.parent));
        }
        public void SetValueConvertsParameterValueToString()
        {
            var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);

            target.SetValue(this.parent, int.Parse(ParameterValue, CultureInfo.InvariantCulture));
            Assert.AreEqual(ParameterValue, this.projectItem.Metadata[ParameterName]);
        }
        public void SetValueRemovesProjectItemMetadataWhenValueIsSameAsDefault()
        {
            this.projectItem.Metadata[ParameterName] = ParameterValue;
            var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);

            target.SetValue(this.parent, default(int));
            Assert.IsFalse(this.projectItem.Metadata.ContainsKey(ParameterName));
        }
        public void SetValueThrowsArgumentNullExceptionWhenComponentIsNull()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            target.SetValue(null, "42");
        }
        public void SetValueThrowsArgumentExceptionWhenComponentIsOfWrongType()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            target.SetValue(new object(), "42");
        }
 public void ShouldSerializeValueReturnsTrueWhenParameterValueIsDifferentFromDefault()
 {
     var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);
     target.SetValue(this.parent, int.Parse(ParameterValue, CultureInfo.InvariantCulture));
     Assert.IsTrue(target.ShouldSerializeValue(this.parent));            
 }
 public void ShouldSerializeValueReturnsFalseWhenParameterValueIsSameAsDefault()
 {
     var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);
     target.SetValue(this.parent, default(int));
     Assert.IsFalse(target.ShouldSerializeValue(this.parent));
 }
 public void SetValueRemovesProjectItemMetadataWhenValueIsSameAsDefault()
 {
     this.projectItem.Metadata[ParameterName] = ParameterValue;
     var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);
     target.SetValue(this.parent, default(int));
     Assert.IsFalse(this.projectItem.Metadata.ContainsKey(ParameterName));
 }
 public void SetValueConvertsParameterValueToString()
 {
     var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);
     target.SetValue(this.parent, int.Parse(ParameterValue, CultureInfo.InvariantCulture));
     Assert.AreEqual(ParameterValue, this.projectItem.Metadata[ParameterName]);                        
 }
 public void SetValueStoresValueInProjectItemMetadata()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.SetValue(this.parent, ParameterValue);
     Assert.AreEqual(ParameterValue, this.projectItem.Metadata[ParameterName]);            
 }
 public void SetValueThrowsArgumentExceptionWhenComponentIsOfWrongType()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.SetValue(new object(), "42");
 }
 public void SetValueThrowsArgumentNullExceptionWhenComponentIsNull()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.SetValue(null, "42");
 }