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

            Assert.AreEqual(ParameterValue, target.GetValue(this.parent));
        }
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 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));
        }
Exemplo n.º 5
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.º 6
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.º 7
0
 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);
 }
Exemplo n.º 8
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.º 9
0
        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);
        }
Exemplo n.º 10
0
        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));
        }
Exemplo n.º 11
0
        public void GetValueReturnsDefaultValueTypeValueWhenProjectItemMetadataDoesNotExist()
        {
            var target = new CustomToolParameter(ParameterName, typeof(int), string.Empty);

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

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

            Assert.AreEqual(typeof(int?), target.PropertyType);
        }
Exemplo n.º 15
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.º 16
0
 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));                        
 }
Exemplo n.º 17
0
        public void ShouldSerializeValueThrowsArgumentNullExceptionWhenComponentIsNull()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            target.ShouldSerializeValue(null);
        }
Exemplo n.º 18
0
 public void ConstructorInitializesName()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.AreEqual(ParameterName, target.Name);
 }
Exemplo n.º 19
0
 public void ComponentTypeReturnsTypeOfCustomToolParametersClass()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.AreEqual(typeof(CustomToolParameters), target.ComponentType);
 }
Exemplo n.º 20
0
 public void AttributesCollectionDoesNotContainDescriptionAttributeWhenDescriptionIsEmpty()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.IsFalse(target.Attributes.OfType<System.ComponentModel.DescriptionAttribute>().Any());
 }
Exemplo n.º 21
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.º 22
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.º 23
0
        public void GetValueReturnsNullWhenParameterTypeIsNotSpecified()
        {
            var target = new CustomToolParameter(ParameterName, typeof(void), string.Empty);

            Assert.IsNull(target.GetValue(this.parent));
        }
Exemplo n.º 24
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.º 25
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.º 26
0
 public void GetValueReturnsNullWhenParameterTypeIsNotSpecified()
 {
     var target = new CustomToolParameter(ParameterName, typeof(void), string.Empty);
     Assert.IsNull(target.GetValue(this.parent));
 }
Exemplo n.º 27
0
 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));
 }
Exemplo n.º 28
0
        public void IsReadOnlyReturnsFalse()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

            Assert.IsFalse(target.IsReadOnly);
        }
Exemplo n.º 29
0
 public void IsReadOnlyReturnsFalse()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     Assert.IsFalse(target.IsReadOnly);            
 }
Exemplo n.º 30
0
 public void ShouldSerializeValueThrowsArgumentExceptionWhenComponentIsOfWrongType()
 {
     var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);
     target.ShouldSerializeValue(new object());
 }
Exemplo n.º 31
0
        public void ShouldSerializeValueThrowsArgumentExceptionWhenComponentIsOfWrongType()
        {
            var target = new CustomToolParameter(ParameterName, typeof(string), string.Empty);

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

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

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

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

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

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