public void testCreateHandlingEventWithCarrierMovement() { cargoRepository.Expect(c => c.find(trackingId)).Return(cargo); VoyageNumber voyageNumber = SampleVoyages.pacific1.VoyageNumber; UnLocode unLocode = L.STOCKHOLM.UnLocode; HandlingEvent handlingEvent = factory.createHandlingEvent(new DateTime(100), trackingId, voyageNumber, unLocode, HandlingActivityType.LOAD, new OperatorCode("ABCDE")); Assert.IsNotNull(handlingEvent); Assert.AreEqual(L.STOCKHOLM, handlingEvent.Location); Assert.AreEqual(SampleVoyages.pacific1, handlingEvent.Voyage); Assert.AreEqual(cargo, handlingEvent.Cargo); Assert.AreEqual(new DateTime(100), handlingEvent.CompletionTime); Assert.True(handlingEvent.RegistrationTime < DateTime.Now.AddMilliseconds(1)); }
public void testRegisterNew() { TrackingId expectedTrackingId = new TrackingId("TRK1"); UnLocode fromUnlocode = new UnLocode("USCHI"); UnLocode toUnlocode = new UnLocode("SESTO"); trackingIdFactory.Expect(t => t.nextTrackingId()).Return(expectedTrackingId); locationRepository.Expect(l => l.find(fromUnlocode)).Return(L.CHICAGO); locationRepository.Expect(l => l.find(toUnlocode)).Return(L.STOCKHOLM); cargoRepository.Expect(c => c.store(Arg <Cargo> .Is.TypeOf)); TrackingId trackingId = bookingService.bookNewCargo(fromUnlocode, toUnlocode, DateTime.Now); Assert.AreEqual(expectedTrackingId, trackingId); }
public void testRegisterEvent() { cargoRepository.Expect(cr => cr.find(cargo.TrackingId)).Return(cargo); voyageRepository.Expect(vr => vr.find(SampleVoyages.pacific1.VoyageNumber)).Return(SampleVoyages.pacific1); locationRepository.Expect(lr => lr.find(L.STOCKHOLM.UnLocode)).Return(L.STOCKHOLM); handlingEventRepository.Expect(her => her.store(Arg <HandlingEvent> .Is.TypeOf)); systemEvents.Expect(se => se.notifyOfHandlingEvent(Arg <HandlingEvent> .Is.TypeOf)); service.registerHandlingEvent(DateTime.Now, cargo.TrackingId, SampleVoyages.pacific1.VoyageNumber, L.STOCKHOLM.UnLocode, HandlingActivityType.LOAD, new OperatorCode("ABCDE")); }