本文整理汇总了C#中Cargo.SpecifyNewRoute方法的典型用法代码示例。如果您正苦于以下问题:C# Cargo.SpecifyNewRoute方法的具体用法?C# Cargo.SpecifyNewRoute怎么用?C# Cargo.SpecifyNewRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cargo
的用法示例。
在下文中一共展示了Cargo.SpecifyNewRoute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testRoutingStatus
public void testRoutingStatus()
{
Cargo cargo = new Cargo(new TrackingId("XYZ"),
new RouteSpecification(L.STOCKHOLM, L.MELBOURNE, DateTime.Now));
Itinerary good = new Itinerary(Leg.DeriveLeg(northernRail, L.SEATTLE, L.NEWYORK));
Itinerary bad = new Itinerary(Leg.DeriveLeg(crazyVoyage, L.HAMBURG, L.HONGKONG));
RouteSpecification acceptOnlyGood = new RouteSpecification(L.SEATTLE, L.NEWYORK, DateTime.Now);
cargo.SpecifyNewRoute(acceptOnlyGood);
Assert.AreEqual(RoutingStatus.NOT_ROUTED, cargo.RoutingStatus);
cargo.AssignToRoute(bad);
Assert.AreEqual(RoutingStatus.MISROUTED, cargo.RoutingStatus);
cargo.AssignToRoute(good);
Assert.AreEqual(RoutingStatus.ROUTED, cargo.RoutingStatus);
}
示例2: TestRoutingStatus
public void TestRoutingStatus()
{
Cargo cargo = new Cargo(new TrackingId("XYZ"),
new RouteSpecification(SampleLocations.STOCKHOLM, SampleLocations.MELBOURNE,
DateTime.Now));
var good = new Itinerary();
var bad = new Itinerary();
RouteSpecification acceptOnlyGood = new RouteSpecificationStub(cargo.Origin,
cargo.RouteSpecification.Destination,
DateTime.Now, good);
cargo.SpecifyNewRoute(acceptOnlyGood);
Assert.AreEqual(RoutingStatus.NOT_ROUTED, cargo.Delivery.RoutingStatus);
cargo.AssignToRoute(bad);
Assert.AreEqual(RoutingStatus.MISROUTED, cargo.Delivery.RoutingStatus);
cargo.AssignToRoute(good);
Assert.AreEqual(RoutingStatus.ROUTED, cargo.Delivery.RoutingStatus);
}
示例3: testCustomsClearancePoint
public void testCustomsClearancePoint()
{
//cargo destination NYC
Cargo cargo = new Cargo(new TrackingId("XYZ"), new RouteSpecification(L.SHANGHAI, L.NEWYORK, DateTime.Now));
Assert.That(cargo.CustomsClearancePoint, Is.EqualTo(Location.None));
//SHA-LGB-NYC
cargo.AssignToRoute(new Itinerary(Leg.DeriveLeg(pacific, L.SHANGHAI, L.LONGBEACH),
Leg.DeriveLeg(transcontinental, L.LONGBEACH, L.NEWYORK)));
Assert.AreEqual(L.LONGBEACH, cargo.CustomsClearancePoint);
//SHA-SEA-NYC
cargo.AssignToRoute(new Itinerary(Leg.DeriveLeg(pacific, L.SHANGHAI, L.SEATTLE),
Leg.DeriveLeg(northernRail, L.SEATTLE, L.NEWYORK)));
Assert.AreEqual(L.SEATTLE, cargo.CustomsClearancePoint);
//cargo destination LGB
//SHA-LGB
cargo.SpecifyNewRoute(new RouteSpecification(L.SHANGHAI, L.LONGBEACH, DateTime.Now));
cargo.AssignToRoute(new Itinerary(Leg.DeriveLeg(pacific, L.SHANGHAI, L.LONGBEACH)));
Assert.AreEqual(L.LONGBEACH, cargo.CustomsClearancePoint);
//Cargo destination HAMBURG
//SHA-LGB-NYC This itinerary does not take
// the cargo into its CustomsZone, so no clearancePoint.
cargo.SpecifyNewRoute(new RouteSpecification(L.SHANGHAI, L.HAMBURG, DateTime.Now));
cargo.AssignToRoute(new Itinerary(Leg.DeriveLeg(pacific, L.SHANGHAI, L.LONGBEACH),
Leg.DeriveLeg(transcontinental, L.LONGBEACH, L.NEWYORK)));
Assert.IsNull(cargo.CustomsClearancePoint);
//Cargo destination NEWYORK on SHA-LGB-CHI
//This itinerary does not take the cargo to its destination,
//but it does enter the CustomsZone, so it has a clearancePoint.
cargo.SpecifyNewRoute(new RouteSpecification(L.SHANGHAI, L.NEWYORK, DateTime.Now));
cargo.AssignToRoute(new Itinerary(Leg.DeriveLeg(pacific, L.SHANGHAI, L.LONGBEACH),
Leg.DeriveLeg(transcontinental, L.LONGBEACH, L.CHICAGO)));
Assert.AreEqual(L.LONGBEACH, cargo.CustomsClearancePoint);
}