Exemplo n.º 1
0
        public virtual void test_equals_bad()
        {
            FxRate test = FxRate.of(AUD, GBP, 1.25d);

            assertFalse(test.Equals(ANOTHER_TYPE));
            assertFalse(test.Equals(null));
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void test_equals_hashCode()
        {
            FxRate a1 = FxRate.of(AUD, GBP, 1.25d);
            FxRate a2 = FxRate.of(AUD, GBP, 1.25d);
            FxRate b  = FxRate.of(USD, GBP, 1.25d);
            FxRate c  = FxRate.of(USD, GBP, 1.35d);

            assertEquals(a1.Equals(a1), true);
            assertEquals(a1.Equals(a2), true);
            assertEquals(a1.Equals(b), false);
            assertEquals(a1.Equals(c), false);

            assertEquals(b.Equals(a1), false);
            assertEquals(b.Equals(a2), false);
            assertEquals(b.Equals(b), true);
            assertEquals(b.Equals(c), false);

            assertEquals(c.Equals(a1), false);
            assertEquals(c.Equals(a2), false);
            assertEquals(c.Equals(b), false);
            assertEquals(c.Equals(c), true);

            assertEquals(a1.GetHashCode(), a2.GetHashCode());
        }