コード例 #1
0
ファイル: Test.cs プロジェクト: ikayzo/SDL.NET
		////////////////////////////////////////////////////////////////////////////
		// Tag Tests
		////////////////////////////////////////////////////////////////////////////
		private static void TestTag() {	
			Console.WriteLine("Doing basic Tag tests...");
			
			// Test to make sure Tag ignores the order in which attributes are
			// added.
			Console.WriteLine("    Making sure attributes are consistently ordered...");
			Tag t1 = new Tag("test");
			t1["foo"]="bar";
            t1["john"]="doe";
			
			Tag t2 = new Tag("test");
            t2["john"]="doe";
			t2["foo"]="bar";
			
			AssertEquals(TAG, t1, t2);
			
			Console.WriteLine("    Making sure tags with different structures return " +
					"false from .equals...");
			
			t2.Value="item";
			AssertNotEquals(TAG, t1, t2);
			
			t2.RemoveValue("item");
			t2["another"] = "attribute";
			AssertNotEquals(TAG, t1, t2);
			
			Console.WriteLine("    Checking attributes namespaces...");
			
			t2["name"]="bill";

            // setting attributes with namespaces
			t2["private","smoker"]=true;
			t2["public", "hobby"]="hiking";
			t2["private", "nickname"]="tubby";

			AssertEquals(TAG, t2.GetAttributesForNamespace("private"),
					Map("smoker",true,"nickname","tubby"));
		}