public void Equals_Returns_False_If_Other_Object_Different_Type()
        {
            var identifier = new EntityIdentifier("88");

            identifier
            .Equals(int.MaxValue)
            .Should()
            .BeFalse();
            identifier
            .Equals(new Exception())
            .Should()
            .BeFalse();
        }
        public void Equals_Returns_True_If_Other_Object_Is_Same_Identifier()
        {
            var identifier = new EntityIdentifier("AbCdEf");

            identifier
            .Equals(new EntityIdentifier("AbCdEf"))
            .Should()
            .BeTrue();
            identifier
            .Equals(new EntityIdentifier("aBcDeF"))
            .Should()
            .BeTrue();
        }
        public void Equals_Returns_False_If_Other_Object_Is_Different_Identifier()
        {
            var identifier = new EntityIdentifier("12345");

            identifier
            .Equals(new EntityIdentifier("123456"))
            .Should()
            .BeFalse();
            identifier
            .Equals(new EntityIdentifier("012345"))
            .Should()
            .BeFalse();
        }
Example #4
0
        /// <summary>
        /// Determines whether two <see cref="EntityIdentifier" /> instances represent the
        /// same identifier.
        /// </summary>
        /// <param name="identifierOne">
        /// The first <see cref="EntityIdentifier" /> instance to compare, or null.
        /// </param>
        /// <param name="identifierTwo">
        /// The second <see cref="EntityIdentifier" /> instance to compare, or null.
        /// </param>
        /// <returns>
        /// True, if the two instances represent the same identifier (or they're both
        /// null); otherwise, false.
        /// </returns>
        public static bool Equal(
            EntityIdentifier identifierOne, EntityIdentifier identifierTwo)
        {
            bool equal = false;

            if ((object)identifierOne != null && (object)identifierTwo != null)
            {
                equal = identifierOne.Equals(identifierTwo);
            }
            else if ((object)identifierOne == null && (object)identifierTwo == null)
            {
                equal = true;
            }
            return(equal);
        }