public void CalculateDeliveryDateSameWarehouseSameDay() { using (TransactionScope scope = new TransactionScope()) { //set-up two warehouses TDCShipment tdcShipment = new TDCShipment(); Warehouse stockWarehouse = WarehouseTests.PopulateNewItem(); WarehouseTests.SaveItem(stockWarehouse); tdcShipment.StockWarehouseCode = stockWarehouse.Code; tdcShipment.DeliveryWarehouseCode = stockWarehouse.Code; tdcShipment.RequiredShipmentDate = new DateTime(2006, 07, 24); tdcShipment.OpCoCode = "HSP"; Route route = RouteTests.PopulateNewItem(); route.IsNextDay = false; route.IsSameDay = true; RouteTests.SaveItem(route); tdcShipment.RouteCode = route.Code; tdcShipment.CalculateDeliveryDate(); Assert.IsTrue(tdcShipment.EstimatedDeliveryDate == new DateTime(2006, 07, 24)); } }
public void GetMappingLookup() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { if (MappingController.DeleteAllMappingSystems()) { if (MappingController.DeleteAllMappingPropertyAssociations()) { if (MappingController.DeleteAllMappingClassAssociations()) { Mapping mapping = PopulateMappingItem(); if (MappingController.SaveMapping(mapping) != -1) { //we have set the lookup table to be route so we should add a route and then when we get the lookup list //back it should include the RouteCode we save in the routing table Route route = RouteTests.PopulateNewItem(); if (RouteTests.SaveItem(route) != -1) { //get a list of route codes from the route table Dictionary <string, string> lookupList = MappingController.GetMappingLookup(mapping.MappingPropertyAssociationId); //so the count should be >0 Assert.IsTrue(lookupList.Count > 0); //check for our new id Assert.IsTrue(lookupList.ContainsValue(route.Description)); } } } } } } } }
static internal TDCShipment PopulateItem() { TDCShipment tdcShipment = new TDCShipment(); OpCoShipment opCoShipment = OpcoShipmentTests.PopulateNewItem(); try { tdcShipment.OpCoShipmentId = OpCoShipmentController.SaveShipment(opCoShipment); } catch (InValidBusinessObjectException e) { Console.Write(e.ValidatableObject.ValidationMessages); } tdcShipment.OpCoCode = opCoShipment.OpCoCode; tdcShipment.OpCoSequenceNumber = 1; tdcShipment.OpCoContact.Email = "Email"; tdcShipment.OpCoContact.Name = "Name"; tdcShipment.DespatchNumber = "Number"; tdcShipment.RequiredShipmentDate = DateTime.Now; tdcShipment.CustomerNumber = "CustNo"; tdcShipment.CustomerName = "CustomerName"; tdcShipment.CustomerReference = "ref"; tdcShipment.CustomerAddress.Line1 = "Line1"; tdcShipment.CustomerAddress.PostCode = "NN8 1NB"; tdcShipment.ShipmentNumber = "ShipNo"; tdcShipment.ShipmentName = "ShipmentName"; tdcShipment.ShipmentAddress.Line1 = "Line1"; tdcShipment.ShipmentAddress.PostCode = "NN8 1NB"; tdcShipment.SalesBranchCode = "BranchCode"; tdcShipment.AfterTime = "11:11"; tdcShipment.BeforeTime = "10:10"; tdcShipment.TailLiftRequired = false; tdcShipment.CheckInTime = 1; tdcShipment.DivisionCode = "Div"; tdcShipment.GeneratedDateTime = DateTime.Now; tdcShipment.Status = Shipment.StatusEnum.Mapped; tdcShipment.IsRecurring = false; tdcShipment.IsValidAddress = false; tdcShipment.PAFAddress.Line1 = "Line1"; tdcShipment.PAFAddress.PostCode = "PostCode"; tdcShipment.UpdatedBy = "UpdatedBy"; tdcShipment.Instructions = "Instructions"; tdcShipment.VehicleMaxWeight = (decimal)1.1; OpCoDivision division = OpcoDivisionTests.PopulateNewItem(); OpcoDivisionTests.SaveItem(division); tdcShipment.DivisionCode = division.Code; Warehouse deliveryWarehouse = WarehouseTests.PopulateNewItem(); WarehouseTests.SaveItem(deliveryWarehouse); tdcShipment.DeliveryWarehouseCode = deliveryWarehouse.Code; Warehouse stockWarehouse = WarehouseTests.PopulateNewItem(); WarehouseTests.SaveItem(stockWarehouse); tdcShipment.StockWarehouseCode = stockWarehouse.Code; Route route = RouteTests.PopulateNewItem(); RouteTests.SaveItem(route); tdcShipment.RouteCode = route.Code; TransactionType transactionType = TransactionTypeTests.PopulateNewItem(); TransactionTypeTests.SaveItem(transactionType); tdcShipment.TransactionTypeCode = transactionType.Code; TransactionSubType transactionSubType = TransactionSubTypeTests.PopulateNewItem(); TransactionSubTypeTests.SaveItem(transactionSubType); tdcShipment.TransactionSubTypeCode = transactionSubType.Code; return(tdcShipment); }