コード例 #1
0
        public void Equals_05()
        {
            // arrange:
            UnLocode  first  = new UnLocode("CDFST");
            UnLocode  second = new UnLocode("CDSND");
            UnLocode  third  = new UnLocode("CDTRD");
            ILocation origin = MockRepository.GenerateStrictMock <ILocation>();

            origin.Expect(l => l.UnLocode).Return(first).Repeat.Any();
            ILocation destination = MockRepository.GenerateStrictMock <ILocation>();

            destination.Expect(l => l.UnLocode).Return(second).Repeat.Any();
            ILocation destination2 = MockRepository.GenerateStrictMock <ILocation>();

            destination2.Expect(l => l.UnLocode).Return(third).Repeat.Any();
            DateTime            arrivalDeadline = DateTime.UtcNow + TimeSpan.FromDays(5);
            IRouteSpecification specification1  = new RouteSpecification(origin, destination, arrivalDeadline);
            IRouteSpecification specification2  = new RouteSpecification(origin, destination2, arrivalDeadline);

            // assert:
            Assert.IsFalse(specification1.Equals(specification2));
            Assert.IsFalse(specification2.Equals(specification1));
            Assert.IsFalse(specification1.Equals((object)specification2));
            Assert.IsFalse(specification2.Equals((object)specification1));
            origin.VerifyAllExpectations();
            destination.VerifyAllExpectations();
        }
コード例 #2
0
        public void testEquals()
        {
            RouteSpecification HKG_DAL              = new RouteSpecification(L.HONGKONG, L.DALLAS, DateTime.Parse("2009-03-01"));
            RouteSpecification HKG_DAL_AGAIN        = new RouteSpecification(L.HONGKONG, L.DALLAS, DateTime.Parse("2009-03-01"));
            RouteSpecification SHA_DAL              = new RouteSpecification(L.SHANGHAI, L.DALLAS, DateTime.Parse("2009-03-01"));
            RouteSpecification HKG_CHI              = new RouteSpecification(L.HONGKONG, L.CHICAGO, DateTime.Parse("2009-03-01"));
            RouteSpecification HKG_DAL_LATERARRIVAL = new RouteSpecification(L.HONGKONG,
                                                                             L.DALLAS,
                                                                             DateTime.Parse("2009-03-15"));

            Assert.AreEqual(HKG_DAL, HKG_DAL_AGAIN);
            Assert.False(HKG_DAL.Equals(SHA_DAL));
            Assert.False(HKG_DAL.Equals(HKG_CHI));
            Assert.False(HKG_DAL.Equals(HKG_DAL_LATERARRIVAL));
        }
コード例 #3
0
        public void testEquals()
        {
            RouteSpecification HKG_DAL = new RouteSpecification(L.HONGKONG, L.DALLAS, DateTime.Parse("2009-03-01"));
            RouteSpecification HKG_DAL_AGAIN = new RouteSpecification(L.HONGKONG, L.DALLAS, DateTime.Parse("2009-03-01"));
            RouteSpecification SHA_DAL = new RouteSpecification(L.SHANGHAI, L.DALLAS, DateTime.Parse("2009-03-01"));
            RouteSpecification HKG_CHI = new RouteSpecification(L.HONGKONG, L.CHICAGO, DateTime.Parse("2009-03-01"));
            RouteSpecification HKG_DAL_LATERARRIVAL = new RouteSpecification(L.HONGKONG,
                L.DALLAS,
                DateTime.Parse("2009-03-15"));

            Assert.AreEqual(HKG_DAL, HKG_DAL_AGAIN);
            Assert.False(HKG_DAL.Equals(SHA_DAL));
            Assert.False(HKG_DAL.Equals(HKG_CHI));
            Assert.False(HKG_DAL.Equals(HKG_DAL_LATERARRIVAL));
        }