예제 #1
0
		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");
		}
예제 #2
0
		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");
		}
예제 #3
0
		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)");
		}
예제 #4
0
		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");
		}
예제 #5
0
		public void NullAllowed ()
		{
			ToolboxDataAttribute at = new ToolboxDataAttribute (null);
			Assert.AreEqual (at.Data, null, "Null Data");
		}