本文整理汇总了C#中Cargo.Handled方法的典型用法代码示例。如果您正苦于以下问题:C# Cargo.Handled方法的具体用法?C# Cargo.Handled怎么用?C# Cargo.Handled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cargo
的用法示例。
在下文中一共展示了Cargo.Handled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setUp
public void setUp()
{
reportSubmission = MockRepository.GenerateMock<ReportSubmission>();
CargoRepository cargoRepository = new CargoRepositoryInMem();
HandlingEventRepository handlingEventRepository = new HandlingEventRepositoryInMem();
HandlingEventFactory handlingEventFactory = new HandlingEventFactory(cargoRepository,
new VoyageRepositoryInMem(),
new LocationRepositoryInMem());
TrackingId trackingId = new TrackingId("ABC");
RouteSpecification routeSpecification = new RouteSpecification(L.HONGKONG, L.ROTTERDAM, DateTime.Parse("2009-10-10"));
Cargo cargo = new Cargo(trackingId, routeSpecification);
cargoRepository.store(cargo);
HandlingEvent handlingEvent = handlingEventFactory.createHandlingEvent(
DateTime.Parse("2009-10-02"),
trackingId,
null,
L.HONGKONG.UnLocode,
HandlingActivityType.RECEIVE,
new OperatorCode("ABCDE")
);
handlingEventRepository.store(handlingEvent);
cargo.Handled(handlingEvent.Activity);
reportPusher = new ReportPusher(reportSubmission, cargoRepository, handlingEventRepository);
eventSequenceNumber = handlingEvent.SequenceNumber;
}
示例2: testIsReadyToClaimWithDestinationSameAsCustomsClearancePoint
public void testIsReadyToClaimWithDestinationSameAsCustomsClearancePoint()
{
Cargo cargo = new Cargo(new TrackingId("CARGO1"),
new RouteSpecification(L.SHANGHAI, L.SEATTLE, DateTime.Parse("2009-12-24")));
Itinerary itinerary = new Itinerary(Leg.DeriveLeg(V.pacific2, L.SHANGHAI, L.SEATTLE));
cargo.AssignToRoute(itinerary);
Assert.IsTrue(cargo.RouteSpecification.Destination.sameAs(cargo.CustomsClearancePoint));
Assert.IsFalse(cargo.IsReadyToClaim);
cargo.Handled(HandlingActivity.UnloadOff(V.pacific2).In(L.SEATTLE));
Assert.IsFalse(cargo.IsReadyToClaim);
cargo.Handled(HandlingActivity.CustomsIn(L.SEATTLE));
Assert.IsTrue(cargo.IsReadyToClaim);
cargo.Handled(HandlingActivity.ClaimIn(L.SEATTLE));
Assert.IsFalse(cargo.IsReadyToClaim);
}
示例3: testIsReadyToClaimWithDestinationDifferentFromCustomsClearancePoint
public void testIsReadyToClaimWithDestinationDifferentFromCustomsClearancePoint()
{
Cargo cargo = new Cargo(new TrackingId("CARGO1"),
new RouteSpecification(L.HONGKONG, L.NEWYORK, DateTime.Parse("2009-12-24")));
Itinerary itinerary = new Itinerary(Leg.DeriveLeg(V.pacific1, L.HONGKONG, L.LONGBEACH),
Leg.DeriveLeg(V.continental2, L.LONGBEACH, L.NEWYORK));
cargo.AssignToRoute(itinerary);
Assert.IsFalse(cargo.RouteSpecification.Destination.sameAs(cargo.CustomsClearancePoint));
Assert.IsFalse(cargo.IsReadyToClaim);
cargo.Handled(HandlingActivity.UnloadOff(V.pacific1).In(L.LONGBEACH));
Assert.IsFalse(cargo.IsReadyToClaim);
cargo.Handled(HandlingActivity.LoadOnto(V.continental2).In(L.LONGBEACH));
Assert.IsFalse(cargo.IsReadyToClaim);
cargo.Handled(HandlingActivity.UnloadOff(V.continental2).In(L.NEWYORK));
Assert.IsTrue(cargo.IsReadyToClaim);
}
示例4: LoadHibernateData
public void LoadHibernateData()
{
var tt = new TransactionTemplate(transactionManager);
tt.Execute(ts => {
var session = SessionFactory.GetCurrentSession();
foreach(var location in SampleLocations.getAll())
{
session.Save(location);
}
session.Save(SampleVoyages.HONGKONG_TO_NEW_YORK);
session.Save(SampleVoyages.NEW_YORK_TO_DALLAS);
session.Save(SampleVoyages.DALLAS_TO_HELSINKI);
session.Save(SampleVoyages.HELSINKI_TO_HONGKONG);
session.Save(SampleVoyages.DALLAS_TO_HELSINKI_ALT);
var routeSpecification = new RouteSpecification(
SampleLocations.HONGKONG,
SampleLocations.HELSINKI,
DateTime.Parse("2009-03-15"));
var trackingId = new TrackingId("ABC123");
var abc123 = new Cargo(trackingId, routeSpecification);
var itinerary = new Itinerary(new[] {
Leg.DeriveLeg(SampleVoyages.HONGKONG_TO_NEW_YORK, SampleLocations.HONGKONG, SampleLocations.NEWYORK),
Leg.DeriveLeg(SampleVoyages.NEW_YORK_TO_DALLAS, SampleLocations.NEWYORK, SampleLocations.DALLAS),
Leg.DeriveLeg(SampleVoyages.DALLAS_TO_HELSINKI, SampleLocations.DALLAS, SampleLocations.HELSINKI),
});
abc123.AssignToRoute(itinerary);
session.Save(abc123);
var event01 = HandlingEventFactory.createHandlingEvent(
DateTime.Parse("2009-03-01"),
trackingId,
null,
SampleLocations.HONGKONG.UnLocode,
HandlingActivityType.RECEIVE,
new OperatorCode("ABCDE")
);
session.Save(event01);
var event02 = HandlingEventFactory.createHandlingEvent(
DateTime.Parse("2009-03-02"),
trackingId,
SampleVoyages.HONGKONG_TO_NEW_YORK.VoyageNumber,
SampleLocations.HONGKONG.UnLocode,
HandlingActivityType.LOAD,
new OperatorCode("ABCDE")
);
session.Save(event02);
var event03 = HandlingEventFactory.createHandlingEvent(
DateTime.Parse("2009-03-05"),
trackingId,
SampleVoyages.HONGKONG_TO_NEW_YORK.VoyageNumber,
SampleLocations.NEWYORK.UnLocode,
HandlingActivityType.UNLOAD,
new OperatorCode("ABCDE")
);
session.Save(event03);
var handlingEvent = HandlingEventRepository.mostRecentHandling(abc123);
abc123.Handled(handlingEvent.Activity);
session.Update(abc123);
// Cargo JKL567
var routeSpecification1 = new RouteSpecification(
SampleLocations.HANGZOU,
SampleLocations.STOCKHOLM,
DateTime.Parse("2009-03-18"));
var trackingId1 = new TrackingId("JKL567");
var jkl567 = new Cargo(trackingId1, routeSpecification1);
var itinerary1 = new Itinerary(new[] {
Leg.DeriveLeg(SampleVoyages.HONGKONG_TO_NEW_YORK, SampleLocations.HANGZOU, SampleLocations.NEWYORK),
Leg.DeriveLeg(SampleVoyages.NEW_YORK_TO_DALLAS, SampleLocations.NEWYORK, SampleLocations.DALLAS),
Leg.DeriveLeg(SampleVoyages.DALLAS_TO_HELSINKI, SampleLocations.DALLAS, SampleLocations.STOCKHOLM),
});
jkl567.AssignToRoute(itinerary1);
session.Save(jkl567);
var event1 = HandlingEventFactory.createHandlingEvent(
DateTime.Parse("2009-03-01"),
trackingId1,
null,
SampleLocations.HANGZOU.UnLocode,
HandlingActivityType.RECEIVE,
new OperatorCode("ABCDE")
);
session.Save(event1);
var event2 = HandlingEventFactory.createHandlingEvent(
DateTime.Parse("2009-03-03"),
trackingId1,
SampleVoyages.HONGKONG_TO_NEW_YORK.VoyageNumber,
//.........这里部分代码省略.........