public void GetAllSourceMappingSystems() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { if (MappingController.DeleteAllMappingSystems()) { MappingSystem mappingSystem = PopulateNewSourceMappingSystem(); mappingSystem.Id = MappingController.SaveMappingSystem(mappingSystem); if (mappingSystem.Id != -1) { //retrieve all mapping Systems and the one we saved should return at least List <MappingSystem> mappingSystems = MappingController.GetMappingSourceSystems(); //so the count should be >0 Assert.IsTrue(mappingSystems.Count > 0); //check for our new id Assert.IsTrue(mappingSystems.Find(delegate(MappingSystem currentItem) { return(currentItem.Id == mappingSystem.Id); }) != null); } } } } }
public void GetItems() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { if (MappingController.DeleteAllMappingSystems()) { if (MappingController.DeleteAllMappingPropertyAssociations()) { if (MappingController.DeleteAllMappingClassAssociations()) { Mapping mapping = PopulateMappingItem(); mapping.Id = MappingController.SaveMapping(mapping); if (mapping.Id != -1) { List <Mapping> mappings = MappingController.GetMappings(); //so the count should be >0 Assert.IsTrue(mappings.Count > 0); //check for our new id Assert.IsTrue(mappings.Find(delegate(Mapping currentItem) { return(currentItem.Id == mapping.Id); }) != null); } } } } } } }
public void UpdateItem() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { if (MappingController.DeleteAllMappingSystems()) { if (MappingController.DeleteAllMappingPropertyAssociations()) { if (MappingController.DeleteAllMappingClassAssociations()) { Mapping item = PopulateMappingItem(); item.SourceValue = "Original"; item.Id = MappingController.SaveMapping(item); item = GetItem(item.Id); //change a value item.SourceValue = "Updated"; MappingController.SaveMapping(item); item = GetItem(item.Id); Assert.IsTrue(item.SourceValue == "Updated"); } } } } } }
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)); } } } } } } } }
public void ConcurrencyTest() { using (TransactionScope scope = new TransactionScope()) { MappingController.DeleteAllMappings(); MappingController.DeleteAllMappingSystems(); MappingController.DeleteAllMappingPropertyAssociations(); MappingController.DeleteAllMappingClassAssociations(); try { Mapping item = PopulateMappingItem(); item.Id = MappingController.SaveMapping(item); //change a value item.MappingPropertyAssociation.DestinationProperty = "Updated"; MappingController.SaveMapping(item); } catch (DiscoveryException e) { Assert.IsInstanceOfType(typeof(ConcurrencyException), e.InnerException); throw e; } } }
public void DeleteAllMappingSystems() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { Assert.IsTrue(MappingController.DeleteAllMappingSystems()); } } }
public void SaveDestinationMappingSystem() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { if (MappingController.DeleteAllMappingSystems()) { Assert.IsTrue(MappingController.SaveMappingSystem(PopulateNewDestinationMappingSystem()) != -1); } } } }
public void SaveDestinationMappingSystemConstraint() { using (TransactionScope scope = new TransactionScope()) { MappingController.DeleteAllMappings(); MappingController.DeleteAllMappingSystems(); MappingSystem system = PopulateNewDestinationMappingSystem(); if (MappingController.SaveMappingSystem(system) != -1) { MappingController.SaveMappingSystem(system); } } }
public void SaveMappingTestConstraint() { using (TransactionScope scope = new TransactionScope()) { MappingController.DeleteAllMappings(); MappingController.DeleteAllMappingSystems(); MappingController.DeleteAllMappingPropertyAssociations(); MappingController.DeleteAllMappingClassAssociations(); Mapping mapping = PopulateMappingItem(); MappingController.SaveMapping(mapping); MappingController.SaveMapping(mapping); } }
public void DeleteAllMappings() { using (TransactionScope scope = new TransactionScope()) { MappingController.DeleteAllMappings(); MappingController.DeleteAllMappingSystems(); MappingController.DeleteAllMappingPropertyAssociations(); MappingController.DeleteAllMappingClassAssociations(); Mapping mapping = PopulateMappingItem(); int id = MappingController.SaveMapping(mapping); Assert.IsTrue(id != -1); Assert.IsTrue(MappingController.DeleteAllMappings()); } }
public void SaveDestinationMappingClassAssociationConstraint() { using (TransactionScope scope = new TransactionScope()) { MappingController.DeleteAllMappings(); MappingController.DeleteAllMappingSystems(); MappingController.DeleteAllMappingPropertyAssociations(); MappingController.DeleteAllMappingClassAssociations(); MappingClassAssociation classAssociation = PopulateNewMappingClassAssocation(); MappingController.SaveMappingClassAssociation(classAssociation); MappingController.SaveMappingClassAssociation(classAssociation); } }
public void SaveMappingPropertyAssociation() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { if (MappingController.DeleteAllMappingSystems()) { if (MappingController.DeleteAllMappingPropertyAssociations()) { if (MappingController.DeleteAllMappingClassAssociations()) { Assert.IsTrue(MappingController.SaveMappingPropertyAssociation(PopulateNewMappingPropertyAssocation()) != -1); } } } } } }
public void GetItem() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { if (MappingController.DeleteAllMappingSystems()) { if (MappingController.DeleteAllMappingPropertyAssociations()) { if (MappingController.DeleteAllMappingClassAssociations()) { int id = MappingController.SaveMapping(PopulateMappingItem()); Assert.IsNotNull(GetItem(id)); } } } } } }
public void Map() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { if (MappingController.DeleteAllMappingSystems()) { if (MappingController.DeleteAllMappingPropertyAssociations()) { if (MappingController.DeleteAllMappingClassAssociations()) { //add a mapping for route code Mapping mapping; mapping = PopulateMappingItem(); mapping.SourceValue = "OpcoValue"; mapping.DestinationValue = "TDCValue"; MappingController.SaveMapping(mapping); //set up source object to map to destination OpCoShipment sourceObject = OpcoShipmentTests.PopulateNewItem(); sourceObject.RouteCode = mapping.SourceValue; //set up a new instance of a TDC shipment to map the new values into TDCShipment destinationObject = new TDCShipment(); //perform the mapping MappingController.Map(sourceObject, destinationObject, mapping.SourceSystem.Name, mapping.DestinationSystem.Name, DoLines); Assert.IsTrue ( destinationObject.GetType().GetProperty(mapping.MappingPropertyAssociation.DestinationProperty). GetValue(destinationObject, null).Equals( mapping.DestinationValue) && ((sourceObject.ShipmentLines == null || sourceObject.ShipmentLines.Count == 0) || destinationObject.ShipmentLines.Count > 0) && ((destinationObject.ShipmentLines == null || destinationObject.ShipmentLines.Count == 0) || destinationObject.ShipmentLines[0] is TDCShipmentLine) && ((sourceObject.ShipmentLines == null || sourceObject.ShipmentLines.Count == 0) || sourceObject.ShipmentLines[0].ConversionQuantity == destinationObject.ShipmentLines[0].ConversionQuantity) && sourceObject.CustomerAddress != null && sourceObject.OpCoContact != null && sourceObject.AfterTime == destinationObject.AfterTime && sourceObject.BeforeTime == destinationObject.BeforeTime && sourceObject.CheckInTime == destinationObject.CheckInTime && sourceObject.CustomerAddress.Line1 == destinationObject.CustomerAddress.Line1 && sourceObject.CustomerName == destinationObject.CustomerName && sourceObject.CustomerNumber == destinationObject.CustomerNumber && sourceObject.CustomerReference == destinationObject.CustomerReference && sourceObject.DeliveryWarehouseCode == destinationObject.DeliveryWarehouseCode && sourceObject.DespatchNumber == destinationObject.DespatchNumber && sourceObject.DivisionCode == destinationObject.DivisionCode && sourceObject.GeneratedDateTime == destinationObject.GeneratedDateTime && sourceObject.Instructions == destinationObject.Instructions && sourceObject.OpCoCode == destinationObject.OpCoCode && sourceObject.OpCoContact.Email == destinationObject.OpCoContact.Email && sourceObject.OpCoHeld == destinationObject.OpCoHeld && sourceObject.OpCoSequenceNumber == destinationObject.OpCoSequenceNumber && sourceObject.RequiredShipmentDate == destinationObject.RequiredShipmentDate && // sourceObject.RouteCode == destinationObject.RouteCode && sourceObject.SalesBranchCode == destinationObject.SalesBranchCode && sourceObject.ShipmentName == destinationObject.ShipmentName && sourceObject.ShipmentNumber == destinationObject.ShipmentNumber && sourceObject.Status == destinationObject.Status && sourceObject.StockWarehouseCode == destinationObject.StockWarehouseCode && sourceObject.TailLiftRequired == destinationObject.TailLiftRequired && sourceObject.TotalLineQuantity == destinationObject.TotalLineQuantity && sourceObject.TransactionTypeCode == destinationObject.TransactionTypeCode && sourceObject.VehicleMaxWeight == destinationObject.VehicleMaxWeight ); } } } } } }