Exemple #1
0
 public void TestInitialize()
 {
     _stateManager = new Mock<IAwbStateManager>(MockBehavior.Strict);
     _stateConfig = new Mock<IStateConfig>(MockBehavior.Strict);
     _helper = new AwbGtdHelper(_stateManager.Object, _stateConfig.Object);
     _fixture = new Fixture();
     _data = _fixture.Create<AirWaybillData>();
 }
Exemple #2
0
		public void ProcessGtd(AirWaybillData data, string newGtd)
		{
			if(!IsReadyForCargoAtCustomsStateId(data.GTD, newGtd)) return;

			// todo: 1. check order of states and return if current state is supper than CargoAtCustomsStateId (257)
			if(data.StateId == _stateConfig.CargoIsCustomsClearedStateId) return;

			_stateManager.SetState(data.Id, _stateConfig.CargoAtCustomsStateId);
		}
        public void Test_AwbUpdateManager_Map_AirWaybillEditModel()
        {
            var model = _context.Create<AwbBrokerModel>();
            var data = new AirWaybillData();

            AwbMapper.Map(model, data);

            model.ShouldBeEquivalentTo(data, options => options.ExcludingMissingProperties());
        }
        public void Test_AwbUpdateManager_Map_BrokerAWBModel()
        {
            var model = _context.Create<AwbAdminModel>();
            var data = new AirWaybillData();

            AwbMapper.Map(model, data);

            model.ShouldBeEquivalentTo(data, options => options.ExcludingMissingProperties());
            data.DateOfArrival.ShouldBeEquivalentTo(DateTimeOffset.Parse(model.DateOfArrivalLocalString));
            data.DateOfDeparture.ShouldBeEquivalentTo(DateTimeOffset.Parse(model.DateOfDepartureLocalString));
        }
Exemple #5
0
		public static string GetAirWaybillDisplay(AirWaybillData data)
		{
			return string.Format("{0} ± {1}_{2} ± {3}_{4}{5}",
				data.Bill,
				data.DepartureAirport,
				data.DateOfDeparture.ToString("ddMMMyyyy").ToUpperInvariant(),
				data.ArrivalAirport,
				data.DateOfArrival.ToString("ddMMMyyyy").ToUpperInvariant(),
				string.IsNullOrWhiteSpace(data.GTD)
					? ""
					: string.Format(" ± {0}_{1}", Entities.GTD, data.GTD));
		}
		private ApplicationIndexModel Test(ClientData[] clients, AirWaybillData[] awbs, long cargoIsFlewStateId)
		{
			_context.IdentityService.SetupGet(x => x.Id).Returns(TestConstants.TestSenderUserId);
			_context.ClientRepository.Setup(x => x.GetAll()).Returns(clients);
			_context.AwbRepository.Setup(x => x.Get()).Returns(awbs);
			_context.StateConfig.SetupGet(x => x.CargoIsFlewStateId).Returns(cargoIsFlewStateId);
			_context.SenderRepository.Setup(x => x.GetByUserId(TestConstants.TestSenderUserId))
				.Returns(TestConstants.TestSenderId);

			var result = _applicationListController.Index();

			var model = (ApplicationIndexModel)result.Model;

			_context.IdentityService.Verify(x => x.Id, Times.Once());
			_context.ClientRepository.Verify(x => x.GetAll(), Times.Once());
			_context.AwbRepository.Verify(x => x.Get(), Times.Once());
			_context.StateConfig.Verify(x => x.CargoIsFlewStateId, Times.Once());
			model.Clients.ShouldAllBeEquivalentTo(clients.ToDictionary(x => x.ClientId, x => x.Nic));
			_context.SenderRepository.Verify(x => x.GetByUserId(TestConstants.TestSenderUserId), Times.Once());

			return model;
		}
Exemple #7
0
		private void BindBag(AirWaybillData data)
		{
			ViewBag.AWB = data.Bill;

			ViewBag.AwbId = data.Id;
		}