Exemple #1
0
        public void GetHashCode_GivenTwoNotEqualsObject_MethodReturDifferentHashCodes()
        {
            var a = new ReportColumn()
            {
                Title = "ColumnA", // <---
                SqlValueExpression = "Exp"
            };

            var b = new ReportColumn()
            {
                Title = "ColumnB", // <---
                SqlValueExpression = "Exp"
            };

            Assert.That(a.GetHashCode(), Is.Not.EqualTo(b.GetHashCode()));

            a = new ReportColumn()
            {
                Title = "ColumnA",
                SqlValueExpression = "ExpA" // <---
            };

            b = new ReportColumn()
            {
                Title = "ColumnA",
                SqlValueExpression = "ExpB" // <---
            };

            Assert.That(a.GetHashCode(), Is.Not.EqualTo(b.GetHashCode()));
        }
Exemple #2
0
        public void Equals_Symmetric()
        {
            var x = new ReportColumn()
            {
                Title = "Column A",
                SqlValueExpression = "select 1"
            };
            var y = new ReportColumn()
            {
                Title = "Column A",
                SqlValueExpression = "select 1"
            };

            Assert.IsTrue(x.Equals(y) && y.Equals(x));
            Assert.IsTrue(x.GetHashCode() == y.GetHashCode());
        }
Exemple #3
0
        public void GetHashCode_GivenTwoEqualsObject_MethodReturEqualHashCodes()
        {
            var a = new ReportColumn()
            {
                Title = "ColumnA",
                SqlValueExpression = "Exp"
            };

            var b = new ReportColumn()
            {
                Title = "ColumnA",
                SqlValueExpression = "Exp"
            };

            Assert.That(a.GetHashCode(), Is.EqualTo(b.GetHashCode()));
        }