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


C# Cargo.Handled方法代码示例

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

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

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

示例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,
//.........这里部分代码省略.........
开发者ID:awhatley,项目名称:dddsample.net,代码行数:101,代码来源:PopulateDatabase.cs


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