• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UnLocode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Append_03

		public void Append_03()
		{
			// arrange:
			UnLocode c1 = new UnLocode("LOCDA");
			UnLocode c2 = new UnLocode("LOCDA");
			
			ICarrierMovement m1 = MockRepository.GenerateStrictMock<ICarrierMovement>();
			m1.Expect(m => m.ArrivalLocation).Return(c1).Repeat.Any();
			m1.Expect(m => m.ArrivalTime).Return(DateTime.UtcNow + new TimeSpan(48, 0, 0)).Repeat.Any();
			ICarrierMovement m2 = MockRepository.GenerateStrictMock<ICarrierMovement>();
			m2.Expect(m => m.DepartureLocation).Return(c2).Repeat.Any();
			m2.Expect(m => m.DepartureTime).Return(DateTime.UtcNow + new TimeSpan(72, 0, 0)).Repeat.Any();
			ISchedule empty = new Schedule();
			ISchedule schedule1 = empty.Append(m1);
		
			// act:
			ISchedule schedule2 = schedule1.Append(m2);
		
			// assert:
			Assert.IsFalse(schedule2.Equals(empty));
			Assert.IsFalse(schedule2.Equals(schedule1));
			Assert.AreSame(m1, schedule2[0]);
			Assert.AreSame(m2, schedule2[1]);
			Assert.AreEqual(2, schedule2.Count());			
			Assert.AreEqual(2, schedule2.MovementsCount);
			m1.VerifyAllExpectations();
			m2.VerifyAllExpectations();
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:28,代码来源:ScheduleQA.cs


示例2: 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


示例3: find

 public Location find(UnLocode unLocode)
 {
     return sessionFactory.GetCurrentSession().
       CreateQuery("from Location where UnLocode = ?").
       SetParameter(0, unLocode).
       UniqueResult<Location>();
 }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:7,代码来源:LocationRepositoryNHibernate.cs


示例4: 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


示例5: Leg

		public Leg (IVoyage voyage, ILocation loadLocation, DateTime loadTime, ILocation unloadLocation, DateTime unloadTime)
		{
			if(null == voyage)
				throw new ArgumentNullException("voyage");
			if(null == loadLocation)
				throw new ArgumentNullException("loadLocation");
			if(null == unloadLocation)
				throw new ArgumentNullException("unloadLocation");
			if(loadTime >= unloadTime)
				throw new ArgumentException("Unload time must follow the load time.","unloadTime");
			if(loadLocation.UnLocode.Equals(unloadLocation.UnLocode))
				throw new ArgumentException("The locations must not be differents.", "unloadLocation");
			if(!voyage.WillStopOverAt(loadLocation))
			{
				string message = string.Format("The voyage {0} will not stop over the load location {1}.", voyage.Number, loadLocation.UnLocode);
				throw new ArgumentException(message, "loadLocation");
			}
			if(!voyage.WillStopOverAt(unloadLocation))
			{
				string message = string.Format("The voyage {0} will not stop over the unload location {1}.", voyage.Number, unloadLocation.UnLocode);
				throw new ArgumentException(message, "unloadLocation");
			}
			
			_voyage = voyage.Number;
			_loadLocation = loadLocation.UnLocode;
			_unloadLocation = unloadLocation.UnLocode;
			_loadTime = loadTime;
			_unloadTime = unloadTime;
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:29,代码来源:Leg.cs


示例6: 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


示例7: Append_01

		public void Append_01()
		{
			// arrange:
			UnLocode loc1 = new UnLocode("CODLD");
			UnLocode loc2 = new UnLocode("CODUN");
			DateTime arrivalDate = DateTime.UtcNow + TimeSpan.FromDays(10);
			ILeg leg = MockRepository.GenerateStrictMock<ILeg>();
			leg.Expect(l => l.LoadLocation).Return(loc1).Repeat.Once();
			leg.Expect(l => l.UnloadLocation).Return(loc2).Repeat.Once();
			leg.Expect(l => l.UnloadTime).Return(arrivalDate).Repeat.Once();
			Itinerary empty = new Itinerary();
		
			// act:
			IItinerary tested = empty.Append(leg);
		
			// assert:
			Assert.IsNotNull(tested);
			Assert.AreEqual(1, tested.Count());
			Assert.AreSame(leg, tested.First());
			Assert.AreSame(leg, tested.Last());
			Assert.AreEqual(loc1, tested.InitialDepartureLocation);
			Assert.AreEqual(loc2, tested.FinalArrivalLocation);
			Assert.AreEqual(arrivalDate, tested.FinalArrivalDate);
			leg.VerifyAllExpectations();
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:25,代码来源:ItineraryQA.cs


示例8: Ctor_02

        public void Ctor_02()
        {
            // arrange:
            List<object> mocks = new List<object>();

            UnLocode code = new UnLocode("START");
            DateTime arrival = DateTime.UtcNow;
            TrackingId id = new TrackingId("CARGO01");
            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(code).Repeat.Any();
            mocks.Add(itinerary);
            IRouteSpecification specification = MockRepository.GenerateStrictMock<IRouteSpecification>();
            specification.Expect(s => s.IsSatisfiedBy(itinerary)).Return(true).Repeat.Any();
            mocks.Add(specification);
            CargoState previousState = MockRepository.GenerateStrictMock<CargoState>(id, specification);
            mocks.Add(previousState);
            previousState = MockRepository.GenerateStrictMock<CargoState>(previousState, itinerary);
            mocks.Add(previousState);
            previousState.Expect(s => s.LastKnownLocation).Return(code).Repeat.Any();

            // act:
            InPortCargo state = new InPortCargo(previousState, code, arrival);

            // assert:
            Assert.IsTrue(TransportStatus.InPort == state.TransportStatus);
			Assert.IsNull(state.CurrentVoyage);
            Assert.AreSame(code, state.LastKnownLocation);
            Assert.IsTrue(state.IsUnloadedAtDestination);
            Assert.AreSame(id, state.Identifier);
            foreach (object mock in mocks)
                mock.VerifyAllExpectations();
        }
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:34,代码来源:InPortCargoQA.cs


示例9: testSave

        public void testSave()
        {
            var unLocode = new UnLocode("SESTO");

            var trackingId = new TrackingId("XYZ");
            var completionTime = DateTime.Parse("2008-01-01");
            HandlingEvent @event = HandlingEventFactory.createHandlingEvent(completionTime,
                trackingId,
                null,
                unLocode,
                HandlingActivityType.CLAIM,
                null);

            HandlingEventRepository.store(@event);

            flush();

            var result = GenericTemplate.QueryForObjectDelegate(CommandType.Text,
                String.Format("select * from HandlingEvent where sequence_number = {0}", @event.SequenceNumber),
                (r, i) => new {CARGO_ID = r["CARGO_ID"], COMPLETIONTIME = r["COMPLETIONTIME"]});

            Assert.AreEqual(1L, result.CARGO_ID);
            Assert.AreEqual(completionTime, result.COMPLETIONTIME);
            // TODO: the rest of the columns
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:25,代码来源:HandlingEventRepositoryTest.cs


示例10: Ctor_01

		public void Ctor_01()
		{
			// arrange:
			UnLocode final = new UnLocode("FINAL");
			TrackingId id = new TrackingId("CLAIM");
			IItinerary itinerary = MockRepository.GenerateStrictMock<IItinerary>();
			itinerary.Expect(i => i.FinalArrivalDate).Return(DateTime.UtcNow).Repeat.AtLeastOnce();
			itinerary.Expect(i => i.FinalArrivalLocation).Return(final).Repeat.AtLeastOnce();
			IRouteSpecification specification = MockRepository.GenerateStrictMock<IRouteSpecification>();
			specification.Expect(s => s.IsSatisfiedBy(itinerary)).Return(true).Repeat.Any();
			CargoState previousState = MockRepository.GenerateStrictMock<CargoState>(id, specification);
			previousState = MockRepository.GenerateStrictMock<CargoState>(previousState, itinerary);
			previousState.Expect(s => s.IsUnloadedAtDestination).Return(true).Repeat.AtLeastOnce();
			previousState.Expect(s => s.TransportStatus).Return(TransportStatus.InPort).Repeat.AtLeastOnce();
			DateTime claimDate = DateTime.UtcNow;
			
		
			// act:
			ClaimedCargo state = new ClaimedCargo(previousState, claimDate);
		
			// assert:
			Assert.AreEqual(TransportStatus.Claimed, state.TransportStatus);
			Assert.AreEqual(RoutingStatus.Routed, state.RoutingStatus);
			Assert.AreSame(final, state.LastKnownLocation);
			Assert.AreSame(specification, state.RouteSpecification);
			Assert.IsNull(state.CurrentVoyage);
			Assert.IsTrue(state.IsUnloadedAtDestination);
			itinerary.VerifyAllExpectations();
			specification.VerifyAllExpectations();
			previousState.VerifyAllExpectations();
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:31,代码来源:ClaimedCargoQA.cs


示例11: 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


示例12: TestHashCode

        public void TestHashCode()
        {
            var allCaps = new UnLocode("ABCDE");
            var mixedCase = new UnLocode("aBcDe");

            Assert.AreEqual(allCaps.GetHashCode(), mixedCase.GetHashCode());
        }
开发者ID:colourblendcreative,项目名称:ndddsample,代码行数:7,代码来源:UnLocodeTest.cs


示例13: Ctor_withNullDestination_throwsArgumentNullException

		public void Ctor_withNullDestination_throwsArgumentNullException ()
		{
			// arrange:
			UnLocode previous = new UnLocode("CDPRV");
		
			// act:
			new VoyageEventArgs(previous, null);
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:8,代码来源:VoyageEventArgsQA.cs


示例14: Ctor_withEmptyName_throwsArgumentNullException

		public void Ctor_withEmptyName_throwsArgumentNullException ()
		{
			// arrange:
			UnLocode code = new UnLocode("UNLOC");
		
			// act:
			Assert.Throws<ArgumentNullException>(delegate{ new Challenge00.DDDSample.Location.Location(code, string.Empty); });
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:8,代码来源:LocationQA.cs


示例15: ChangeDestination

      public void ChangeDestination(TrackingId trackingId, UnLocode destinationUnLocode)
      {
         Cargo cargo = _cargoRepository.Find(trackingId);
         Location destination = _locationRepository.Find(destinationUnLocode);

         RouteSpecification routeSpecification = new RouteSpecification(cargo.RouteSpecification.Origin, destination, cargo.RouteSpecification.ArrivalDeadline);
         cargo.SpecifyNewRoute(routeSpecification);
      }
开发者ID:ssajous,项目名称:DDDSample.Net,代码行数:8,代码来源:BookingService.cs


示例16: Ctor_withNullPreviousLocation_throwsArgumentNullException

		public void Ctor_withNullPreviousLocation_throwsArgumentNullException ()
		{
			// arrange:
			UnLocode destination = new UnLocode("CDDES");
		
			// act:
			new VoyageEventArgs(null, destination);
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:8,代码来源:VoyageEventArgsQA.cs


示例17: Find

        public void Find()
        {
            var melbourne = new UnLocode("AUMEL");
            Location location = locationRepository.Find(melbourne);
            Assert.IsNotNull(location);
            Assert.AreEqual(melbourne, location.UnLocode);

            Assert.IsNull(locationRepository.Find(new UnLocode("NOLOC")));
        }
开发者ID:chandmk,项目名称:esddd,代码行数:9,代码来源:LocationRepositoryTest.cs


示例18: VoyageEventArgs

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="previousLocation">
		/// A <see cref="ILocation"/>
		/// </param>
		/// <param name="destinationLocation">
		/// A <see cref="ILocation"/>
		/// </param>
		/// <exception cref="ArgumentNullException">Any argument is <value>null</value>.</exception>
		public VoyageEventArgs (UnLocode previousLocation, UnLocode destinationLocation)
		{
			if (null == previousLocation)
				throw new ArgumentNullException ("previousLocation");
			if (null == destinationLocation)
				throw new ArgumentNullException ("destinationLocation");
			PreviousLocation = previousLocation;
			DestinationLocation = destinationLocation;
		}
开发者ID:hungdluit,项目名称:Epic.NET,代码行数:19,代码来源:VoyageEventArgs.cs


示例19: find

 public Location find(UnLocode unLocode)
 {
     foreach(Location location in SampleLocations.getAll())
     {
         if(location.UnLocode.Equals(unLocode))
         {
             return location;
         }
     }
     return null;
 }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:11,代码来源:LocationRepositoryInMem.cs


示例20: changeDestination

        public void changeDestination(TrackingId trackingId, UnLocode unLocode)
        {
            var cargo = _cargoRepository.find(trackingId);
            Validate.notNull(cargo, "Can't change destination of non-existing cargo " + trackingId);
            var newDestination = _locationRepository.find(unLocode);

            var routeSpecification = cargo.RouteSpecification.WithDestination(newDestination);
            cargo.SpecifyNewRoute(routeSpecification);

            _cargoRepository.store(cargo);
            _logger.Info("Changed destination for cargo " + trackingId + " to " + routeSpecification.Destination);
        }
开发者ID:awhatley,项目名称:dddsample.net,代码行数:12,代码来源:BookingServiceImpl.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnaryExpression类代码示例发布时间:2022-05-24
下一篇:
C# UmbracoHelper类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap