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


C# VoyageNumber类代码示例

本文整理汇总了C#中VoyageNumber的典型用法代码示例。如果您正苦于以下问题:C# VoyageNumber类的具体用法?C# VoyageNumber怎么用?C# VoyageNumber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VoyageNumber类属于命名空间,在下文中一共展示了VoyageNumber类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Ctor_01

		public void Ctor_01()
		{
			// arrange:
			GList mocks = new GList();
			TrackingId id = new TrackingId("START");
			DateTime loadTime = DateTime.Now;
			VoyageNumber voyageNumber = new VoyageNumber("VYG001");
			UnLocode location = new UnLocode("CURLC");
            IItinerary itinerary = MockRepository.GenerateStrictMock<IItinerary>();
            itinerary.Expect(i => i.Equals(null)).IgnoreArguments().Return(false).Repeat.Any();
            itinerary.Expect(i => i.FinalArrivalDate).Return(DateTime.UtcNow + TimeSpan.FromDays(1)).Repeat.Any();
            itinerary.Expect(i => i.FinalArrivalLocation).Return(new UnLocode("ENDLC")).Repeat.Any();
            mocks.Add(itinerary);
            IRouteSpecification specification = MockRepository.GenerateStrictMock<IRouteSpecification>();
            specification.Expect(s => s.IsSatisfiedBy(itinerary)).Return(true).Repeat.Any();
            CargoState previousState = MockRepository.GenerateStrictMock<CargoState>(id, specification);
            mocks.Add(previousState);
            previousState = MockRepository.GenerateStrictMock<CargoState>(previousState, itinerary);
            mocks.Add(previousState);
			IVoyage voyage = MockRepository.GenerateStrictMock<IVoyage>();
			voyage.Expect(v => v.Number).Return(voyageNumber).Repeat.AtLeastOnce();
			voyage.Expect(v => v.LastKnownLocation).Return(location).Repeat.AtLeastOnce();
			mocks.Add(voyage);
			
			// act:
			CargoState state = new OnboardCarrierCargo(previousState, voyage, loadTime);
		
			// assert:
			Assert.IsNotNull(state);
			Assert.AreSame(voyageNumber, state.CurrentVoyage);
			Assert.AreEqual(TransportStatus.OnboardCarrier, state.TransportStatus);
			Assert.AreSame(location, state.LastKnownLocation);
			foreach(object mock in mocks)
				mock.VerifyAllExpectations();
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:35,代码来源:OnboardCarrierCargoQA.cs

示例2: createHandlingEvent

        /// <summary>
        /// Creates a handling event.
        /// </summary>
        /// <param name="completionTime">when the event was completed, for example finished loading</param>
        /// <param name="trackingId">cargo tracking id</param>
        /// <param name="voyageNumber">voyage number</param>
        /// <param name="unlocode">United Nations Location Code for the location of the event</param>
        /// <param name="type">type of event</param>
        /// <param name="operatorCode">operator code</param>
        /// <returns>A handling event.</returns>
        /// <exception cref="UnknownVoyageException">if there's no voyage with this number</exception>
        /// <exception cref="UnknownCargoException">if there's no cargo with this tracking id</exception>
        /// <exception cref="UnknownLocationException">if there's no location with this UN Locode</exception>
        public HandlingEvent createHandlingEvent(DateTime completionTime, TrackingId trackingId,
                                                 VoyageNumber voyageNumber, UnLocode unlocode,
                                                 HandlingActivityType type, OperatorCode operatorCode)
        {
            var cargo = findCargo(trackingId);
            var voyage = findVoyage(voyageNumber);
            var location = findLocation(unlocode);

            try
            {
                var registrationTime = DateTime.Now;
                if(voyage == null)
                {
                    return new HandlingEvent(cargo, completionTime, registrationTime, type, location);
                }
                else
                {
                    return new HandlingEvent(cargo, completionTime, registrationTime, type, location, voyage, operatorCode);
                }
            }
            catch(Exception e)
            {
                throw new CannotCreateHandlingEventException(e.Message, e);
            }
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:38,代码来源:HandlingEventFactory.cs

示例3: RegisterHandlingEvent

        public void RegisterHandlingEvent(DateTime completionTime,
                                          TrackingId trackingId,
                                          VoyageNumber voyageNumber,
                                          UnLocode unLocode,
                                          HandlingType type)
        {
            //TODO: Revise transaciton and UoW logic
            using (var transactionScope = new TransactionScope())
            {
                var registrationTime = new DateTime();

                /* Using a factory to create a HandlingEvent (aggregate). This is where
               it is determined wether the incoming data, the attempt, actually is capable
               of representing a real handling event. */
                HandlingEvent evnt = handlingEventFactory.CreateHandlingEvent(
                    registrationTime, completionTime, trackingId, voyageNumber, unLocode, type);

                /* Store the new handling event, which updates the persistent
                   state of the handling event aggregate (but not the cargo aggregate -
                   that happens asynchronously!)*/

                handlingEventRepository.Store(evnt);

                /* Publish an event stating that a cargo has been handled. */
                applicationEvents.CargoWasHandled(evnt);

                transactionScope.Complete();
            }
            logger.Info("Registered handling event");
        }
开发者ID:colourblendcreative,项目名称:ndddsample,代码行数:30,代码来源:HandlingEventService.cs

示例4: find

 public Voyage find(VoyageNumber voyageNumber)
 {
     return sessionFactory.GetCurrentSession().
       CreateQuery("from Voyage where VoyageNumber = :vn").
       SetParameter("vn", voyageNumber).
       UniqueResult<Voyage>();
 }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:7,代码来源:VoyageRepositoryNHibernate.cs

示例5: MovingVoyage

		public MovingVoyage (VoyageNumber number, ISchedule schedule, int movementIndex)
			: base(number, schedule)
		{
			if(movementIndex < 0 || movementIndex >= schedule.MovementsCount)
				throw new ArgumentOutOfRangeException("movementIndex");
			_movementIndex = movementIndex;
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:7,代码来源:MovingVoyage.cs

示例6: Ctor_withValidArgs_works

		public void Ctor_withValidArgs_works(EventType type)
		{
			// arrange:
			List<object> mocks = new List<object>();
			Username userId = new Username("Giacomo");
			IUser user = MockRepository.GenerateStrictMock<IUser>();
			user.Expect(u => u.Username).Return(userId).Repeat.Once();
			mocks.Add(user);
			TrackingId cargoId = new TrackingId("CARGO001");
			UnLocode location = new UnLocode("UNLOC");
			VoyageNumber voyage = new VoyageNumber("VYG001");
			ICargo cargo = MockRepository.GenerateStrictMock<ICargo>();
			cargo.Expect(c => c.TrackingId).Return(cargoId).Repeat.Once();
			IDelivery delivery = MockRepository.GenerateStrictMock<IDelivery>();
			delivery.Expect(d => d.LastKnownLocation).Return(location).Repeat.Once();
			delivery.Expect(d => d.CurrentVoyage).Return(voyage).Repeat.Once();
			mocks.Add(delivery);
			cargo.Expect(c => c.Delivery).Return(delivery).Repeat.Twice();
			mocks.Add(cargo);
			DateTime completionDate = DateTime.UtcNow;
			
			// act:
			IEvent underTest = new Event(user, cargo, type, completionDate);
		
			// assert:
			Assert.AreSame(userId, underTest.User);
			Assert.AreSame(cargoId, underTest.Cargo);
			Assert.AreSame(location, underTest.Location);
			Assert.AreSame(voyage, underTest.Voyage);
			Assert.AreEqual(completionDate, underTest.Date);
			Assert.AreEqual(type, underTest.Type);
			foreach(object mock in mocks)
				mock.VerifyAllExpectations();
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:34,代码来源:EventQA.cs

示例7: Ctor_02

		public void Ctor_02 ()
		{
			// arrange:
			VoyageNumber number = new VoyageNumber("VYGTEST01");
		
			// act:
			new CompletedVoyage(number, null);
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:8,代码来源:CompletedVoyageQA.cs

示例8: Ctor_02

		public void Ctor_02 ()
		{
			// arrange:
			VoyageNumber number = new VoyageNumber("VYGTEST01");
		
			// act:
			new MovingVoyage(number, null, 0);
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:8,代码来源:MovingVoyageQA.cs

示例9: Ctor_03

		public void Ctor_03(int index)
		{
			// arrange:
			VoyageNumber number = new VoyageNumber("VYGTEST01");
			ISchedule schedule = MockRepository.GenerateStrictMock<ISchedule>();
			schedule.Expect(s => s.MovementsCount).Return(3).Repeat.Any();
		
			// act:
			new MovingVoyage(number, schedule, index);
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:10,代码来源:MovingVoyageQA.cs

示例10: updateItineraries

        public void updateItineraries(VoyageNumber voyageNumber)
        {
            var voyage = voyageRepository.find(voyageNumber);
            var affectedCargos = cargoRepository.findCargosOnVoyage(voyage);

            foreach(Cargo cargo in affectedCargos)
            {
                var newItinerary = cargo.Itinerary.WithRescheduledVoyage(voyage);
                cargo.AssignToRoute(newItinerary);
                LOG.Info("Updated itinerary of cargo " + cargo);
            }
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:12,代码来源:ItineraryUpdater.cs

示例11: HandlingEventRegistrationAttempt

 public HandlingEventRegistrationAttempt(DateTime registrationDate,
     DateTime completionDate,
     TrackingId trackingId,
     VoyageNumber voyageNumber,
     HandlingType type,
     UnLocode unLocode)
 {
     registrationTime = registrationDate;
     completionTime = completionDate;
     this.trackingId = trackingId;
     this.voyageNumber = voyageNumber;
     this.type = type;
     this.unLocode = unLocode;
 }
开发者ID:chandmk,项目名称:esddd,代码行数:14,代码来源:HandlingEventRegistrationAttempt.cs

示例12: Ctor_01

		public void Ctor_01()
		{
			// arrange:
			VoyageNumber number = new VoyageNumber("VYGTEST01");
			ISchedule schedule = MockRepository.GenerateStrictMock<ISchedule>();
			schedule.Expect(s => s.MovementsCount).Return(3).Repeat.Any();
		
			// act:
			CompletedVoyage state = new CompletedVoyage(number, schedule);
		
			// assert:
			Assert.AreSame(schedule, state.Schedule);
			Assert.IsFalse(state.IsMoving);
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:14,代码来源:CompletedVoyageQA.cs

示例13: findVoyage

        private Voyage findVoyage(VoyageNumber voyageNumber)
        {
            if(voyageNumber == null)
            {
                return null;
            }

            var voyage = voyageRepository.find(voyageNumber);
            if(voyage == null)
            {
                throw new UnknownVoyageException(voyageNumber);
            }

            return voyage;
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:15,代码来源:HandlingEventFactory.cs

示例14: fromDTO

 internal static Itinerary fromDTO(RouteCandidateDTO routeCandidateDTO,
                          VoyageRepository voyageRepository,
                          LocationRepository locationRepository)
 {
     var legs = new List<Leg>(routeCandidateDTO.getLegs().Count());
     foreach(LegDTO legDTO in routeCandidateDTO.getLegs())
     {
         var voyageNumber = new VoyageNumber(legDTO.getVoyageNumber());
         var voyage = voyageRepository.find(voyageNumber);
         var from = locationRepository.find(new UnLocode(legDTO.getFrom()));
         var to = locationRepository.find(new UnLocode(legDTO.getTo()));
         legs.Add(Leg.DeriveLeg(voyage, from, to));
     }
     return new Itinerary(legs);
 }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:15,代码来源:DTOAssembler.cs

示例15: TestCreateHandlingEventUnknownCarrierMovement

        public void TestCreateHandlingEventUnknownCarrierMovement()
        {
            cargoRepositoryMock.Setup(rep => rep.Find(trackingId)).Returns(cargo);

            try
            {
                var invalid = new VoyageNumber("XXX");
                DateTime completionTime = DateTime.Now.AddDays(10);
                factory.CreateHandlingEvent(
                    DateTime.Now, completionTime, trackingId, invalid, SampleLocations.STOCKHOLM.UnLocode,
                    HandlingType.LOAD
                    );
                Assert.Fail("Expected UnknownVoyageException");
            }
            catch (UnknownVoyageException expected) {}
        }
开发者ID:chandmk,项目名称:esddd,代码行数:16,代码来源:HandlingEventFactoryTest.cs


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