Exemplo n.º 1
0
        public void Equals_methods_should_return_false_when_values_are_not_equal()
        {
            var a = new Commit("msg", new DateTime(2011, 1, 1), "larspars", uri, 1);

            var b = new Commit("msg2", new DateTime(2011, 1, 1), "larspars", uri, 1);
            var c = new Commit("msg", new DateTime(2011, 1, 2), "larspars", uri, 1);
            var d = new Commit("msg", new DateTime(2011, 1, 1), "larspars2", uri, 1);
            var e = new Commit("msg", new DateTime(2011, 1, 1), "larspars", anotherUri, 1);

            Assert.IsFalse(a.Equals(b));
            Assert.IsFalse(a.Equals(c));
            Assert.IsFalse(a.Equals(d));
            Assert.IsFalse(a.Equals(e));
        }
Exemplo n.º 2
0
        public void BoxedEqualityFunctions()
        {
            object a = new Commit("abcd");
            object b = new Commit("xyzw");
            var    x = new Commit("abcd");
            var    y = new Commit("xyzw");

            a.Equals(b).Should().BeFalse();
            a.Equals(x).Should().BeTrue();
            a.Equals(y).Should().BeFalse();

            x.Equals(a).Should().BeTrue();
            x.Equals(b).Should().BeFalse();
        }
Exemplo n.º 3
0
        public void Equals_methods_should_not_be_based_on_referential_equality_but_on_values()
        {
            var a = new Commit("msg", new DateTime(2011, 1, 1), "larspars", uri, 1);
            var b = new Commit("msg", new DateTime(2011, 1, 1), "larspars", uri, 1);

            Assert.IsTrue(a.Equals(b));
        }
Exemplo n.º 4
0
        public void BoxedEqualityDifferingTypesFunctions()
        {
            var a = new Commit("abcd");
            var b = new object();

            a.Equals(b).Should().BeFalse();
            b.Equals(a).Should().BeFalse();
        }