public void Defaults () { ToolboxDataAttribute at = new ToolboxDataAttribute (String.Empty); Assert.AreEqual (at.Data, String.Empty, "Data Value"); Assert.AreEqual (ToolboxDataAttribute.Default.Data, String.Empty, "Default Data Value"); }
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)"); }
public void EqualsTest () { string foo_built = new StringBuilder ("f").Append ("oo").ToString (); ToolboxDataAttribute left = new ToolboxDataAttribute (foo_built); ToolboxDataAttribute right = new ToolboxDataAttribute ("foo"); Assert.IsTrue (left.Equals (right), "Equals True"); right = new ToolboxDataAttribute ("bar"); Assert.IsFalse (left.Equals (right), "Equals False"); Assert.IsFalse (left.Equals (45), "Equals Int"); Assert.IsFalse (left.Equals ("foo"), "Equals String"); }
public void NullAllowed () { ToolboxDataAttribute at = new ToolboxDataAttribute (null); Assert.AreEqual (at.Data, null, "Null Data"); }