Ejemplo n.º 1
0
        public void EqualityHasValueSemantics()
        {
            var contract1 = new ContractId(_commonId);
            var contract2 = new ContractId(_commonId);
            var contract3 = new ContractId(Guid.NewGuid().ToString());

            Assert.IsTrue(contract1.Equals(contract1));
            Assert.IsTrue(contract1 == contract1);

            Assert.IsTrue(contract1.Equals(contract2));
            Assert.IsTrue(contract1 == contract2);

            Assert.IsFalse(contract1.Equals(contract3));
            Assert.IsTrue(contract1 != contract3);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns true if BookingInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of BookingInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BookingInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ContractId == other.ContractId ||
                     ContractId != null &&
                     ContractId.Equals(other.ContractId)
                     ) &&
                 (
                     Agency == other.Agency ||

                     Agency.Equals(other.Agency)
                 ) &&
                 (
                     Person == other.Person ||
                     Person != null &&
                     Person.Equals(other.Person)
                 ) &&
                 (
                     Grade == other.Grade ||
                     Grade != null &&
                     Grade.Equals(other.Grade)
                 ) &&
                 (
                     Rates == other.Rates ||
                     Rates != null &&
                     other.Rates != null &&
                     Rates.SequenceEqual(other.Rates)
                 ));
        }