Beispiel #1
0
        public void TestMessageHeader_Equality()
        {
            var h1 = new MessageHeader(_testProps);
            var h2 = new MessageHeader(_testProps);
            var h3 = new MessageHeader();

            // Test all the various flavours of equality

            Assert.AreEqual(h1, h2);
            Assert.True(Equals(h1, h2));
            Assert.True(h1.Equals(h2));
            Assert.True(h1 == h2);

            Assert.AreNotEqual(h1, h3);
            Assert.False(Equals(h1, h3));
            Assert.False(h1.Equals(h3));
            Assert.True(h1 != h3);
        }
        public void ObjectEquals_ValuesCorrectlyCompared(
            string xName,
            string?xValue,
            string?yName,
            string?yValue,
            bool expected)
        {
            var headerX = new MessageHeader(xName, xValue);
            var headerY = yName != null ? new MessageHeader(yName, yValue) : null;

            var result = headerX.Equals((object?)headerY);

            result.Should().Be(expected);
        }