Пример #1
0
        public void BarometerData_Comparison(
            double pressure1,
            double pressure2,
            bool equals)
        {
            var data1 = new BarometerData(pressure1);
            var data2 = new BarometerData(pressure2);

            if (equals)
            {
                Assert.True(data1.Equals(data2));
                Assert.True(data1 == data2);
                Assert.False(data1 != data2);
                Assert.Equal(data1, data2);
                Assert.Equal(data1.GetHashCode(), data2.GetHashCode());
            }
            else
            {
                Assert.False(data1.Equals(data2));
                Assert.False(data1 == data2);
                Assert.True(data1 != data2);
                Assert.NotEqual(data1, data2);
                Assert.NotEqual(data1.GetHashCode(), data2.GetHashCode());
            }
        }
Пример #2
0
        public void BarometerData_Comparison_NotEqual()
        {
            var device1 = new BarometerData(0);
            var device2 = new BarometerData(1);

            Assert.False(device1.Equals(device2));
            Assert.False(device1 == device2);
            Assert.True(device1 != device2);
            Assert.NotEqual(device1, device2);
            Assert.NotEqual(device1.GetHashCode(), device2.GetHashCode());
        }