ToString() 공개 메소드

public ToString ( ) : string
리턴 string
예제 #1
0
파일: SiteTest.cs 프로젝트: nlhepler/mono
		public void Site_GoMonoWebSite () 
		{
			Site s = new Site ("www.go-mono.com");
			Assert.AreEqual ("www.go-mono.com", s.Name, "Name");
#if NET_2_0
			Assert.AreEqual ("<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + "<Name>www.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString (), "ToString");
#else
			Assert.AreEqual ("<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + "   <Name>www.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString (), "ToString");
#endif
			Site s2 = (Site) s.Copy ();
			Assert.AreEqual (s.Name, s2.Name, "Copy.Name");
			Assert.AreEqual (s.GetHashCode (), s2.GetHashCode (), "Copy.GetHashCode");

			SiteIdentityPermission sip = (SiteIdentityPermission) s.CreateIdentityPermission (null);
			Assert.AreEqual (s.Name, sip.Site, "CreateIdentityPermission");

			Assert.IsTrue (s.Equals (s2), "Equals");
			Site s3 = new Site ("go-mono.com");
			Assert.IsTrue (!s.Equals (s3), "!Equals");
		}
예제 #2
0
		public void Site_AllGoMonoSite () 
		{
			Site s = new Site ("*.go-mono.com");
			AssertEquals ("Name", "*.go-mono.com", s.Name);
#if NET_2_0
			AssertEquals ("ToString", "<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + "<Name>*.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString ());
#else
			AssertEquals ("ToString", "<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + "   <Name>*.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString ());
#endif
			Site s2 = (Site) s.Copy ();
			AssertEquals ("Copy.Name", s.Name, s2.Name);
			AssertEquals ("Copy.GetHashCode", s.GetHashCode (), s2.GetHashCode ());

			SiteIdentityPermission sip = (SiteIdentityPermission) s.CreateIdentityPermission (null);
			AssertEquals ("CreateIdentityPermission", s.Name, sip.Site);

			Assert ("Equals", s.Equals (s2));
			Site s3 = new Site ("go-mono.com");
			Assert ("!Equals", !s.Equals (s3));
		}