public void Ctor_String_String(string propertyName, string receiverTypeName) { var attribute = new ProvidePropertyAttribute(propertyName, receiverTypeName); Assert.Equal(propertyName, attribute.PropertyName); Assert.Equal(receiverTypeName, attribute.ReceiverTypeName); }
public void GetPropertyName() { var propertyName = "property"; var attribute = new ProvidePropertyAttribute(propertyName, string.Empty); Assert.Equal(propertyName, attribute.PropertyName); }
public static IEnumerable <object[]> Equals_TestData() { var attribute = new ProvidePropertyAttribute("propertyName", "receiverTypeName"); yield return(new object[] { attribute, attribute, true }); yield return(new object[] { attribute, new ProvidePropertyAttribute("propertyName", "receiverTypeName"), true }); yield return(new object[] { attribute, new ProvidePropertyAttribute("propertyname", "receiverTypeName"), false }); yield return(new object[] { attribute, new ProvidePropertyAttribute(null, "receiverTypeName"), false }); yield return(new object[] { attribute, new ProvidePropertyAttribute("propertyName", "receivertypename"), false }); yield return(new object[] { attribute, new ProvidePropertyAttribute("propertyName", (string)null), false }); yield return(new object[] { new ProvidePropertyAttribute(null, (string)null), new ProvidePropertyAttribute(null, (string)null), true }); yield return(new object[] { new ProvidePropertyAttribute(null, (string)null), new ProvidePropertyAttribute("propertyName", (string)null), false }); yield return(new object[] { new ProvidePropertyAttribute(null, (string)null), new ProvidePropertyAttribute(null, "receiverTypeName"), false }); yield return(new object[] { attribute, new object(), false }); yield return(new object[] { attribute, null, false }); }
public void Ctor_String_Type(string propertyName, Type receiverType) { var attribute = new ProvidePropertyAttribute(propertyName, receiverType); Assert.Equal(propertyName, attribute.PropertyName); Assert.Equal(receiverType.AssemblyQualifiedName, attribute.ReceiverTypeName); }
public void GetReceiverTypeName() { var type = typeof(ProvidePropertyAttribute); var attribute = new ProvidePropertyAttribute(string.Empty, type); Assert.Equal(type.AssemblyQualifiedName, attribute.ReceiverTypeName); }
public void Equals_Other_ReturnsExpected(ProvidePropertyAttribute attribute, object other, bool expected) { Assert.Equal(expected, attribute.Equals(other)); if (other is DesignerAttribute) { Assert.Equal(expected, attribute.GetHashCode().Equals(other.GetHashCode())); } }
public void Equals_SameNames() { var propertyName = "property"; var receiverTypeName = "receiver"; var firstAttribute = new ProvidePropertyAttribute(propertyName, receiverTypeName); var secondAttribute = new ProvidePropertyAttribute(propertyName, receiverTypeName); Assert.True(firstAttribute.Equals(secondAttribute)); }
public override bool Equals(object obj) { if (obj == this) { return(true); } ProvidePropertyAttribute attribute = obj as ProvidePropertyAttribute; return(((attribute != null) && (attribute.propertyName == this.propertyName)) && (attribute.receiverTypeName == this.receiverTypeName)); }
/// <include file='doc\ProvidePropertyAttribute.uex' path='docs/doc[@for="ProvidePropertyAttribute.Equals"]/*' /> public override bool Equals(object obj) { if (obj == this) { return(true); } ProvidePropertyAttribute other = obj as ProvidePropertyAttribute; return((other != null) && other.propertyName == propertyName && other.receiverTypeName == receiverTypeName); }
public void GetHashCode_NullPropertyName_ReturnsEqual() { var attribute = new ProvidePropertyAttribute(null, "receiverTypeName"); if (!PlatformDetection.IsFullFramework) { Assert.Equal(attribute.GetHashCode(), attribute.GetHashCode()); } else { Assert.Throws <NullReferenceException>(() => attribute.GetHashCode()); } }
// Determine if two objects are equal. public override bool Equals(Object obj) { ProvidePropertyAttribute other = (obj as ProvidePropertyAttribute); if (other != null) { return(other.propertyName == propertyName && other.receiverTypeName == receiverTypeName); } else { return(false); } }
public void GetHashCode_NullReceiverTypeName_ThrowsNullReferenceException() { var attribute = new ProvidePropertyAttribute("propertyName", (string)null); Assert.Throws <NullReferenceException>(() => attribute.GetHashCode()); }
public void Equals_Other_ReturnsExpected(ProvidePropertyAttribute attribute, object other, bool expected) { Assert.Equal(expected, attribute.Equals(other)); }
public void GetHashCode_InvokeMultipleTimes_ReturnsEqual() { var attribute = new ProvidePropertyAttribute("propertyName", "receiverTypeName"); Assert.Equal(attribute.GetHashCode(), attribute.GetHashCode()); }