コード例 #1
0
        public void Equal_When_All_Fields_Are_Equal()
        {
            var x = GetPrescriptionProduct();
            var y = GetPrescriptionProduct();

            var comparer = new PrescriptionProductComparer();
            bool result = comparer.Equals(x, y);

            Assert.IsTrue(result);
        }
コード例 #2
0
        public void Return_Correct_HashCode_From_Fields()
        {
            var prescriptionProduct = GetPrescriptionProduct();
            int expectedHashCode = (byte)prescriptionProduct.MutKod ^ prescriptionProduct.PrKode ^
                                   prescriptionProduct.PrNmNr;

            var comparer = new PrescriptionProductComparer();
            int result = comparer.GetHashCode(prescriptionProduct);

            Assert.AreEqual(expectedHashCode, result);
        }
コード例 #3
0
        public void Not_Equal_When_PrNmNr_Is_Different()
        {
            var x = GetPrescriptionProduct();
            var y = GetPrescriptionProduct();
            y.PrNmNr = 3;

            var comparer = new PrescriptionProductComparer();
            bool result = comparer.Equals(x, y);

            Assert.IsFalse(result);
        }
コード例 #4
0
        public void Not_Equal_When_MutKod_Is_Different()
        {
            var x = GetPrescriptionProduct();
            var y = GetPrescriptionProduct();
            y.MutKod = MutKod.RecordUpdated;

            var comparer = new PrescriptionProductComparer();
            bool result = comparer.Equals(x, y);

            Assert.IsFalse(result);
        }