Exemplo n.º 1
0
        public void ShouldSerializeValueReturnsFalseWhenParameterValueIsSameAsDefault()
        {
            var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);

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

            target.SetValue(this.parent, ParameterValue);
            Assert.AreEqual(ParameterValue, this.projectItem.Metadata[ParameterName]);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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]);
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        public void SetValueThrowsArgumentNullExceptionWhenComponentIsNull()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

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

            target.SetValue(new object(), "42");
        }
Exemplo n.º 8
0
 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));            
 }
Exemplo n.º 9
0
 public void ShouldSerializeValueReturnsFalseWhenParameterValueIsSameAsDefault()
 {
     var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);
     target.SetValue(this.parent, default(int));
     Assert.IsFalse(target.ShouldSerializeValue(this.parent));
 }
Exemplo n.º 10
0
 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));
 }
Exemplo n.º 11
0
 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]);                        
 }
Exemplo n.º 12
0
 public void SetValueStoresValueInProjectItemMetadata()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.SetValue(this.parent, ParameterValue);
     Assert.AreEqual(ParameterValue, this.projectItem.Metadata[ParameterName]);            
 }
Exemplo n.º 13
0
 public void SetValueThrowsArgumentExceptionWhenComponentIsOfWrongType()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.SetValue(new object(), "42");
 }
Exemplo n.º 14
0
 public void SetValueThrowsArgumentNullExceptionWhenComponentIsNull()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.SetValue(null, "42");
 }