示例#1
0
        public void ValueEquality()
        {
            var name1 = UnknownResourceName.Parse("a");
            var name2 = UnknownResourceName.Parse("a");

            Assert.True(name1.GetHashCode() == name2.GetHashCode());
            Assert.True(name1.Equals(name2));
            Assert.True(name1.Equals((object)name2));
            Assert.True(name2.Equals(name1));
            Assert.True(name2.Equals((object)name1));
            Assert.True(name1 == name2);
            Assert.False(name1 != name2);
            var name3 = UnknownResourceName.Parse("b");

            Assert.False(name1.GetHashCode() == name3.GetHashCode());
            Assert.False(name1.Equals(name3));
            Assert.False(name1.Equals((object)name3));
            Assert.False(name3.Equals(name1));
            Assert.False(name3.Equals((object)name1));
            Assert.False(name1 == name3);
            Assert.True(name1 != name3);
        }
示例#2
0
 public void Kind()
 {
     Assert.Equal(ResourceNameKind.Unknown, UnknownResourceName.Parse("a").Kind);
 }
示例#3
0
 public void Parse()
 {
     Assert.Equal("a", UnknownResourceName.Parse("a").ToString());
     Assert.Throws <ArgumentNullException>(() => UnknownResourceName.Parse(null));
     Assert.Throws <ArgumentException>(() => UnknownResourceName.Parse(""));
 }