public void Deny_Unrestricted() { ToolboxDataAttribute tda = new ToolboxDataAttribute(null); Assert.IsNull(tda.Data, "Data"); Assert.IsTrue(tda.Equals(tda), "Equals"); Assert.IsFalse(tda.GetHashCode() == ToolboxDataAttribute.Default.GetHashCode(), "GetHashCode"); // unexpected result as tda hash code is different from default // seems that null and String.Empty are both considered defaults... Assert.IsTrue(tda.IsDefaultAttribute(), "IsDefaultAttribute"); }
public void HashcodeTest() { string foo_built = new StringBuilder("f").Append("oo").ToString(); ToolboxDataAttribute left = new ToolboxDataAttribute("foo"); ToolboxDataAttribute right = new ToolboxDataAttribute(foo_built); Assert.AreEqual(left.GetHashCode(), right.GetHashCode(), "Hash identity"); left = new ToolboxDataAttribute(null); right = new ToolboxDataAttribute(null); Assert.AreEqual(left.GetHashCode(), right.GetHashCode(), "Hash identity (with null)"); }