Exemplo n.º 1
0
 public static void ApplicationDirectoryCallMethods()
 {
     ApplicationDirectory ad = new ApplicationDirectory("test");
     object obj   = ad.Copy();
     bool   check = ad.Equals(new object());
     int    hash  = ad.GetHashCode();
     string str   = ad.ToString();
 }
Exemplo n.º 2
0
        public void Copy()
        {
            ApplicationDirectory ad = new ApplicationDirectory("novell");

            Assert.AreEqual("novell", ad.Directory, "Directory");
            ApplicationDirectory copy = (ApplicationDirectory)ad.Copy();

            Assert.IsTrue(ad.Equals(copy), "ad.Equals(copy)");
            Assert.IsTrue(copy.Equals(ad), "copy.Equals(ad)");
            Assert.IsFalse(Object.ReferenceEquals(ad, copy), "Copy");
            Assert.AreEqual(ad.GetHashCode(), copy.GetHashCode(), "GetHashCode");
            Assert.AreEqual(ad.ToString(), copy.ToString(), "ToString");
        }
Exemplo n.º 3
0
        public void Equals_Invalid()
        {
            // funny one
            string appdir = Invalid(true);
            // constructor is ok with an invalid path...
            ApplicationDirectory ad = new ApplicationDirectory(appdir);
            // we can copy it...
            ApplicationDirectory copy = (ApplicationDirectory)ad.Copy();

            // we can't get it's hash code
            Assert.AreEqual(appdir.GetHashCode(), ad.GetHashCode(), "GetHashCode");
            // we can convert it to string...
            Assert.IsTrue(ad.ToString().IndexOf(appdir) > 0, "ToString");
            // ... but it throws in Equals - with self!
            Assert.IsTrue(ad.Equals(ad), "Equals(self)");
        }