当前位置: 首页>>代码示例>>C#>>正文


C# Cargo.SpecifyNewRoute方法代码示例

本文整理汇总了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);
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:17,代码来源:CargoTest.cs

示例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);
        }
开发者ID:colourblendcreative,项目名称:ndddsample,代码行数:21,代码来源:CargoTest.cs

示例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);
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:39,代码来源:CargoTest.cs


注:本文中的Cargo.SpecifyNewRoute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。