Exemple #1
0
        public void Equals_onDifferentVoyage_isFalse_02()
        {
            // arrange:
            DateTime   arrivalDate = DateTime.Now + TimeSpan.FromDays(30);
            TrackingId identifier  = new TrackingId("CARGO01");
            IItinerary itinerary   = MockRepository.GenerateStrictMock <IItinerary>();

            itinerary.Expect(i => i.Equals(null)).Return(false).Repeat.Any();
            itinerary.Expect(i => i.FinalArrivalDate).Return(arrivalDate).Repeat.Any();
            itinerary.Expect(i => i.Equals(itinerary)).Return(true).Repeat.Any();
            IRouteSpecification route = MockRepository.GenerateStrictMock <IRouteSpecification>();

            route.Expect(s => s.Equals(route)).Return(true).Repeat.Any();
            route.Expect(s => s.IsSatisfiedBy(itinerary)).Return(true).Repeat.Any();
            FakeState state1 = new FakeState(identifier, route);

            state1 = new FakeState(state1, itinerary);
            state1._currentVoyage = null;
            FakeState state2 = new FakeState2(identifier, route);

            state2 = new FakeState(state2, itinerary);

            // act:

            // assert:
            Assert.IsFalse(state1.Equals(state2));
        }
Exemple #2
0
        public void Equals_withDifferentItineraries_isFalse()
        {
            // arrange:
            DateTime   arrivalDate = DateTime.Now + TimeSpan.FromDays(30);
            TrackingId identifier  = new TrackingId("CARGO01");
            IItinerary itinerary   = MockRepository.GenerateStrictMock <IItinerary>();

            itinerary.Expect(i => i.Equals(null)).Return(false).Repeat.Any();
            itinerary.Expect(i => i.FinalArrivalDate).Return(arrivalDate).Repeat.Any();
            IRouteSpecification route = MockRepository.GenerateStrictMock <IRouteSpecification>();

            route.Expect(s => s.Equals(route)).Return(true).Repeat.Any();
            route.Expect(s => s.IsSatisfiedBy(itinerary)).Return(true).Repeat.Any();
            FakeState state1 = new FakeState(identifier, route);

            state1 = new FakeState(state1, itinerary);
            state1._lastKnownLocation = new Challenge00.DDDSample.Location.UnLocode("TESTA");
            FakeState state2 = new FakeState2(identifier, route);

            state2._lastKnownLocation = new Challenge00.DDDSample.Location.UnLocode("TESTA");

            // act:

            // assert:
            Assert.IsFalse(state1.Equals(state2));
        }
Exemple #3
0
		public void Equals_withDifferentTypes_isFalse()
		{
			// arrange:
			DateTime arrivalDate = DateTime.Now + TimeSpan.FromDays(30);
			TrackingId identifier = new TrackingId("CARGO01");
			IItinerary itinerary = MockRepository.GenerateStrictMock<IItinerary>();
			itinerary.Expect(i => i.Equals(null)).Return(false).Repeat.Any();
			itinerary.Expect(i => i.Equals(itinerary)).Return(true).Repeat.Any();
			itinerary.Expect(i => i.FinalArrivalDate).Return(arrivalDate).Repeat.Any();
			IRouteSpecification route = MockRepository.GenerateStrictMock<IRouteSpecification>();
			route.Expect(s => s.Equals(route)).Return(true).Repeat.Any();
			route.Expect(s => s.IsSatisfiedBy(itinerary)).Return(true).Repeat.Any();
			FakeState state1 = new FakeState(identifier, route);
			FakeState state2 = new FakeState2(state1, itinerary);
			state1 = new FakeState(state1, itinerary);
		
			// act:
		
			// assert:
			Assert.IsFalse(state1.Equals(state2));
		}