Ejemplo n.º 1
0
        public void Equals()
        {
            var target1 = new MethodMetric("Test");
            var target2 = new MethodMetric("Test");
            var target3 = new MethodMetric("Other");

            Assert.IsTrue(target1.Equals(target2), "Objects are not equal");
            Assert.IsFalse(target1.Equals(target3), "Objects are equal");
            Assert.IsFalse(target1.Equals(null), "Objects are equal");
            Assert.IsFalse(target1.Equals(new object()), "Objects are equal");
        }
Ejemplo n.º 2
0
        public void MethodMetric_Equals()
        {
            var target1 = new MethodMetric("Test", "Test", Enumerable.Empty <Metric>());
            var target2 = new MethodMetric("Test", "Test", Enumerable.Empty <Metric>());
            var target3 = new MethodMetric("Other", "Other", Enumerable.Empty <Metric>());
            var target4 = new MethodMetric("Test", "Test", Enumerable.Empty <Metric>())
            {
                Line = 3
            };

            Assert.True(target1.Equals(target2), "Objects are not equal");
            Assert.False(target1.Equals(target3), "Objects are equal");
            Assert.False(target1.Equals(target4), "Objects are equal");
            Assert.True(target4.Equals(target4), "Objects are not equal");
            Assert.False(target1.Equals(null), "Objects are equal");
            Assert.False(target1.Equals(new object()), "Objects are equal");
        }