public virtual void test_of()
        {
            ExchangeId test = ExchangeId.of("GB");

            assertEquals(test.Name, "GB");
            assertEquals(test.ToString(), "GB");
        }
        //-------------------------------------------------------------------------
        public virtual void test_equalsHashCode()
        {
            ExchangeId a  = ExchangeId.of("ECAG");
            ExchangeId a2 = ExchangeId.of("ECAG");
            ExchangeId b  = ExchangeId.of("XLON");

            assertEquals(a.GetHashCode(), a2.GetHashCode());
            assertEquals(a.Equals(a), true);
            assertEquals(a.Equals(a2), true);
            assertEquals(a.Equals(b), false);
            assertEquals(a.Equals(null), false);
            assertEquals(a.Equals(ANOTHER_TYPE), false);
        }
Exemplo n.º 3
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Checks if this identifier equals another identifier.
        /// <para>
        /// The comparison checks the name.
        ///
        /// </para>
        /// </summary>
        /// <param name="obj">  the other identifier, null returns false </param>
        /// <returns> true if equal </returns>
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null || this.GetType() != obj.GetType())
            {
                return(false);
            }
            ExchangeId that = (ExchangeId)obj;

            return(name.Equals(that.name));
        }
        public virtual void test_serialization()
        {
            ExchangeId test = ExchangeId.of("ECAG");

            assertSerialization(test);
        }