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 GetValueRetrievesValueFromProjectItemMetadata()
        {
            this.projectItem.Metadata[ParameterName] = ParameterValue;
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            Assert.AreEqual(ParameterValue, target.GetValue(this.parent));
        }
        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 GetValueConvertsProjectItemMetadataToPropertyType()
        {
            this.projectItem.Metadata[ParameterName] = ParameterValue;
            var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);

            Assert.AreEqual(int.Parse(ParameterValue, CultureInfo.InvariantCulture), target.GetValue(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 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 AttributesCollectionContainsDescriptionAttributeWhenDescriptionIsNotEmpty()
 {
     const string ParameterDescription = "Description of Parameter";
     var target = new CustomToolParameter(ParameterName, typeof(string), ParameterDescription);
     var descriptionAttribute = target.Attributes.OfType<System.ComponentModel.DescriptionAttribute>().Single();
     Assert.AreEqual(ParameterDescription, descriptionAttribute.Description);
 }
        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 AttributesCollectionContainsDescriptionAttributeWhenDescriptionIsNotEmpty()
        {
            const string ParameterDescription = "Description of Parameter";
            var          target = new CustomToolParameter(ParameterName, typeof(string), ParameterDescription);
            var          descriptionAttribute = target.Attributes.OfType <System.ComponentModel.DescriptionAttribute>().Single();

            Assert.AreEqual(ParameterDescription, descriptionAttribute.Description);
        }
        public void ResetValueRemovesProjectItemMetadata()
        {
            this.projectItem.Metadata[ParameterName] = ParameterValue;
            var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);

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

            Assert.AreEqual(default(int), target.GetValue(this.parent));
        }
        public void GetValueReturnsDefaultReferenceTypeValueWhenProjectItemMetadataDoesNotExist()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            Assert.IsNull(target.GetValue(this.parent));
        }
 public void GetValueReturnsDefaultReferenceTypeValueWhenProjectItemMetadataDoesNotExist()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.IsNull(target.GetValue(this.parent));
 }
        public void PropertyTypeReturnsParameterTypePassedToConstructor()
        {
            var target = new CustomToolParameter(ParameterName, typeof(int?), string.Empty);

            Assert.AreEqual(typeof(int?), target.PropertyType);
        }
 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 GetValueConvertsProjectItemMetadataToPropertyType()
 {
     this.projectItem.Metadata[ParameterName] = ParameterValue;
     var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);
     Assert.AreEqual(int.Parse(ParameterValue, CultureInfo.InvariantCulture), target.GetValue(this.parent));                        
 }
        public void ShouldSerializeValueThrowsArgumentNullExceptionWhenComponentIsNull()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            target.ShouldSerializeValue(null);
        }
 public void ConstructorInitializesName()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.AreEqual(ParameterName, target.Name);
 }
 public void ComponentTypeReturnsTypeOfCustomToolParametersClass()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.AreEqual(typeof(CustomToolParameters), target.ComponentType);
 }
 public void AttributesCollectionDoesNotContainDescriptionAttributeWhenDescriptionIsEmpty()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.IsFalse(target.Attributes.OfType<System.ComponentModel.DescriptionAttribute>().Any());
 }
 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 ShouldSerializeValueReturnsFalseWhenParameterValueIsSameAsDefault()
 {
     var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);
     target.SetValue(this.parent, default(int));
     Assert.IsFalse(target.ShouldSerializeValue(this.parent));
 }
        public void GetValueReturnsNullWhenParameterTypeIsNotSpecified()
        {
            var target = new CustomToolParameter(ParameterName, typeof(void), string.Empty);

            Assert.IsNull(target.GetValue(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 SetValueStoresValueInProjectItemMetadata()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.SetValue(this.parent, ParameterValue);
     Assert.AreEqual(ParameterValue, this.projectItem.Metadata[ParameterName]);            
 }
 public void GetValueReturnsNullWhenParameterTypeIsNotSpecified()
 {
     var target = new CustomToolParameter(ParameterName, typeof(void), string.Empty);
     Assert.IsNull(target.GetValue(this.parent));
 }
 public void ResetValueRemovesProjectItemMetadata()
 {
     this.projectItem.Metadata[ParameterName] = ParameterValue;
     var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);
     target.ResetValue(this.parent);
     Assert.IsFalse(this.projectItem.Metadata.ContainsKey(ParameterName));
 }
        public void IsReadOnlyReturnsFalse()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            Assert.IsFalse(target.IsReadOnly);
        }
 public void IsReadOnlyReturnsFalse()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.IsFalse(target.IsReadOnly);            
 }
 public void ShouldSerializeValueThrowsArgumentExceptionWhenComponentIsOfWrongType()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.ShouldSerializeValue(new object());
 }
        public void ShouldSerializeValueThrowsArgumentExceptionWhenComponentIsOfWrongType()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            target.ShouldSerializeValue(new object());
        }
        public void ConstructorInitializesName()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            Assert.AreEqual(ParameterName, target.Name);
        }
 public void IsReadOnlyReturnsTrueWhenParameterTypeCannotBeConvertedFromString()
 {
     var target = new CustomToolParameter(ParameterName, typeof(void), string.Empty);
     Assert.IsTrue(target.IsReadOnly);                        
 }
 public void GetValueReturnsDefaultValueTypeValueWhenProjectItemMetadataDoesNotExist()
 {
     var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);
     Assert.AreEqual(default(int), target.GetValue(this.parent));            
 }
        public void AttributesCollectionDoesNotContainDescriptionAttributeWhenDescriptionIsEmpty()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            Assert.IsFalse(target.Attributes.OfType <System.ComponentModel.DescriptionAttribute>().Any());
        }
 public void PropertyTypeReturnsParameterTypePassedToConstructor()
 {
     var target = new CustomToolParameter(ParameterName, typeof(int?), string.Empty);
     Assert.AreEqual(typeof(int?), target.PropertyType);
 }
        public void ComponentTypeReturnsTypeOfCustomToolParametersClass()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            Assert.AreEqual(typeof(CustomToolParameters), target.ComponentType);
        }
 public void CanResetValueReturnsTrue()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.IsTrue(target.CanResetValue(this.parent));
 }
        public void IsReadOnlyReturnsTrueWhenParameterTypeCannotBeConvertedFromString()
        {
            var target = new CustomToolParameter(ParameterName, typeof(void), string.Empty);

            Assert.IsTrue(target.IsReadOnly);
        }
 public void GetValueThrowsArgumentNullExceptionWhenComponentIsNull()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.GetValue(null);
 }
        public void CanResetValueReturnsTrue()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            Assert.IsTrue(target.CanResetValue(this.parent));
        }
 public void GetValueRetrievesValueFromProjectItemMetadata()
 {
     this.projectItem.Metadata[ParameterName] = ParameterValue;
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.AreEqual(ParameterValue, target.GetValue(this.parent));
 }