Beispiel #1
0
        public bool Equals(Number320 other)
        {
            bool t1 = LocationKey.Equals(other.LocationKey);
            bool t2 = DomainKey.Equals(other.DomainKey);

            return(t1 && t2);
        }
            public void Will_return_non_successful_result_if_destination_location_keys_are_not_provided_for_all_items()
            {
                //Arrange
                var order = TestHelper.CreateObjectGraphAndInsertIntoDatabase <TreatmentOrder>(
                    o => o.InventoryShipmentOrder.OrderType   = InventoryShipmentOrderTypeEnum.TreatmentOrder,
                    o => o.InventoryShipmentOrder.OrderStatus = OrderStatus.Scheduled,
                    o => o.InventoryShipmentOrder.ShipmentInformation.Status = ShipmentStatus.Scheduled);

                var destinationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>(l => l.ConstrainByKeys(order.InventoryShipmentOrder.DestinationFacility)));
                var items          = new List <PostItemParameters>
                {
                    new PostItemParameters
                    {
                        PickedInventoryItemKey = new PickedInventoryItemKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PickedInventoryItem>(i => i.ConstrainByKeys(order.InventoryShipmentOrder))),
                        DestinationLocationKey = destinationKey,
                    }
                };

                TestHelper.CreateObjectGraphAndInsertIntoDatabase <PickedInventoryItem>(i => i.ConstrainByKeys(order.InventoryShipmentOrder));

                //Act
                var result = Service.Post(new PostParameters
                {
                    UserToken = TestUser.UserName,
                    OrderKey  = new InventoryShipmentOrderKey(order),
                    PickedItemDestinations = items
                });

                //Assert
                result.AssertNotSuccess(UserMessages.DestinationLocationRequiredForPicked);
            }
        // player scene should always be empty, so it doesnt load an extra copy on scene load
        static void AddAliasDefenition(ObjectAlias alias)
        {
            string     scene = null;
            Vector3    pos   = Vector3.zero;
            Quaternion rot   = Quaternion.identity;

            LocationKey key = alias.location.GetKey();

            if (key != null)
            {
                scene = key.scene;

                if (!string.IsNullOrEmpty(scene))
                {
                    bool loaded = Locations.GetLocationTransform(key, out MiniTransform t);
                    if (loaded)
                    {
                        pos = t.position;
                        rot = Quaternion.Euler(t.rotation);
                    }
                }
            }

            AddNewAliasedObject(alias.alias, alias.prefabRef, scene, pos, rot, true, out _);

            GetStateByAlias(alias.alias).isUntouched = true;
        }
 public static void MovePlayer(LocationKey lKey, bool forceReload)
 {
     if (lKey != null)
     {
         MovePlayer(lKey.scene, lKey.name, forceReload);
     }
 }
Beispiel #5
0
            public void Creates_PickedInventory_with_Archived_set_to_true()
            {
                //Arrange
                var inventory              = TestHelper.CreateObjectGraphAndInsertIntoDatabase <Inventory>(i => i.Lot.SetAdditiveLot(), i => i.Quantity = 100);
                var inventoryKey           = new InventoryKey(inventory);
                var destinationLocationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>(l => l.ConstrainByKeys(inventory.Location.Facility)));

                //Act
                var result = Service.CreateIntraWarehouseOrder(new CreateIntraWarehouseOrderParameters
                {
                    UserToken           = TestUser.UserName,
                    TrackingSheetNumber = 123.1m,
                    OperatorName        = "Manny",
                    MovementDate        = new DateTime(2020, 1, 1),
                    PickedItems         = new List <IIntraWarehouseOrderPickedItemParameters>
                    {
                        new IntraWarehouseOrderPickedItemParameters
                        {
                            InventoryKey           = inventoryKey.KeyValue,
                            DestinationLocationKey = destinationLocationKey,
                            Quantity = 10
                        }
                    }
                });

                //Assert
                result.AssertSuccess();
                var pickedInventory = RVCUnitOfWork.PickedInventoryRepository.All().Single();

                Assert.IsTrue(pickedInventory.Archived);
            }
            public void Will_create_Inventory_as_expected_when_posting_TreatmentOrder()
            {
                //Arrange
                var order = TestHelper.CreateObjectGraphAndInsertIntoDatabase <TreatmentOrder>(
                    o => o.InventoryShipmentOrder.OrderType   = InventoryShipmentOrderTypeEnum.TreatmentOrder,
                    o => o.InventoryShipmentOrder.OrderStatus = OrderStatus.Scheduled,
                    o => o.InventoryShipmentOrder.ShipmentInformation.Status = ShipmentStatus.Scheduled);
                var items = new List <PickedInventoryItem>
                {
                    TestHelper.CreateObjectGraphAndInsertIntoDatabase <PickedInventoryItem>(i => i.ConstrainByKeys(order.InventoryShipmentOrder)),
                    TestHelper.CreateObjectGraphAndInsertIntoDatabase <PickedInventoryItem>(i => i.ConstrainByKeys(order.InventoryShipmentOrder))
                };
                var destinationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>(l => l.ConstrainByKeys(order.InventoryShipmentOrder.DestinationFacility)));
                var expected       = items.ToDictionary(i => i, i => new InventoryKey(i, i, destinationKey, i, i.ToteKey));

                //Act
                var result = Service.Post(new PostParameters
                {
                    UserToken = TestUser.UserName,
                    OrderKey  = new InventoryShipmentOrderKey(order),
                    PickedItemDestinations = items.Select(i => new PostItemParameters
                    {
                        PickedInventoryItemKey = new PickedInventoryItemKey(i),
                        DestinationLocationKey = destinationKey
                    })
                });

                //Assert
                result.AssertSuccess();
                foreach (var item in expected)
                {
                    Assert.AreEqual(item.Key.Quantity, RVCUnitOfWork.InventoryRepository.FindByKey(item.Value).Quantity);
                }
            }
            public void Returns_non_succesful_result_if_any_Items_received_have_a_Quantity_not_greater_than_0()
            {
                //Arrange
                var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated));
                var dehydratorKey   = new CompanyKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Dehydrator)));

                var packagingProductKey0  = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>());
                var warehouseLocationKey0 = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>());

                //Act
                var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters
                {
                    UserToken       = TestUser.UserName,
                    DateReceived    = new DateTime(2012, 3, 29),
                    ChileProductKey = chileProductKey,
                    SupplierKey     = dehydratorKey,
                    TreatmentKey    = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(),
                    Items           = new List <ChileMaterialsReceivedItemParameters>
                    {
                        new ChileMaterialsReceivedItemParameters
                        {
                            Quantity            = 0,
                            Variety             = "variety",
                            PackagingProductKey = packagingProductKey0.KeyValue,
                            LocationKey         = warehouseLocationKey0.KeyValue
                        }
                    }
                });

                //Assert
                result.AssertNotSuccess(UserMessages.QuantityNotGreaterThanZero);
            }
            public void Creates_new_Inventory_record_as_expected_if_Adjustment_quantity_is_positive_and_Inventory_record_does_not_previously_exist()
            {
                //Arrange
                const int    adjustmentQuantity   = 12;
                const string toteKey              = "";
                var          userToken            = TestUser.UserName;
                var          lotKey               = new LotKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Lot>(l => l.EmptyLot()));
                var          packagingProductKey  = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>());
                var          warehouseLocationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>());
                var          treatmentKey         = new InventoryTreatmentKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <InventoryTreatment>());
                var          inventoryKey         = new InventoryKey(lotKey, packagingProductKey, warehouseLocationKey, treatmentKey, toteKey);

                //Act
                var result = Service.CreateInventoryAdjustment(new Params
                {
                    UserToken            = userToken,
                    InventoryAdjustments = new List <IInventoryAdjustmentParameters>
                    {
                        new Params.ParamsItem(inventoryKey)
                        {
                            Adjustment = adjustmentQuantity
                        }
                    }
                });

                //Assert
                result.AssertSuccess();
                Assert.AreEqual(adjustmentQuantity, RVCUnitOfWork.InventoryRepository.FindByKey(inventoryKey).Quantity);
            }
 public static void MoveObject(DynamicObject key, LocationKey lKey)
 {
     if (lKey != null)
     {
         MoveObject(key, lKey.scene, lKey.name);
     }
 }
Beispiel #10
0
        public bool Equals(Number480 other)
        {
            var t1 = LocationKey.Equals(other.LocationKey);
            var t2 = DomainKey.Equals(other.DomainKey);
            var t3 = ContentKey.Equals(other.ContentKey);

            return(t1 && t2 && t3);
        }
Beispiel #11
0
 internal PickedInventoryParameters(IInventoryKey inventoryKey, int quantity, string customerLotCode, string customerProductCode)
 {
     InventoryKey        = new InventoryKey(inventoryKey);
     CurrentLocationKey  = new LocationKey(InventoryKey);
     Quantity            = quantity;
     CustomerLotCode     = customerLotCode;
     CustomerProductCode = customerProductCode;
 }
Beispiel #12
0
 public Location GetLocation(LocationKey key)
 {
     if (Lookup == null)
     {
         CreateLookup();
     }
     return(Lookup[key]);
 }
Beispiel #13
0
 public static LocationDefenition GetLocation(LocationKey key)
 {
     if (key != null)
     {
         return(GetLocation(key.scene, key.name));
     }
     return(null);
 }
Beispiel #14
0
 public static bool GetLocationTransform(LocationKey key, out MiniTransform transform)
 {
     if (key == null)
     {
         transform = new MiniTransform(Vector3.zero);
         return(false);
     }
     return(GetLocationTransform(key.scene, key.name, out transform));
 }
Beispiel #15
0
        public bool Equals(Number640 other)
        {
            var t1 = LocationKey.Equals(other.LocationKey);
            var t2 = DomainKey.Equals(other.DomainKey);
            var t3 = ContentKey.Equals(other.ContentKey);
            var t4 = VersionKey.Equals(other.VersionKey);

            return(t1 && t2 && t3 && t4);
        }
Beispiel #16
0
        public int CompareTo(Number320 other)
        {
            int diff = LocationKey.CompareTo(other.LocationKey);

            if (diff != 0)
            {
                return(diff);
            }
            return(DomainKey.CompareTo(other.DomainKey));
        }
Beispiel #17
0
        public string GetSceneName()
        {
            LocationKey key = GetKey();

            if (key == null)
            {
                return(null);
            }
            return(key.scene);
        }
            public void Creates_DehydratedMaterialsReceived_record_as_expected_on_success()
            {
                //Arrange
                var          expectedLotDate         = new DateTime(2012, 3, 29);
                const int    expectedLotDateSequence = 1;
                const int    expectedLotTypeId       = (int)LotTypeEnum.DeHydrated;
                const string expectedLoad            = "123";
                const string expectedPurchaseOrder   = "MLAH!";
                const string expectedShipperNumber   = "1029384756";

                var chileProductKey     = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated));
                var packagingProductKey = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>());
                var locationKey         = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>());
                var supplierKey         = new CompanyKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Dehydrator)));

                //Act
                var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters
                {
                    ChileMaterialsReceivedType = ChileMaterialsReceivedType.Dehydrated,
                    UserToken       = TestUser.UserName,
                    DateReceived    = expectedLotDate,
                    ChileProductKey = chileProductKey,
                    SupplierKey     = supplierKey,
                    TreatmentKey    = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(),
                    LoadNumber      = expectedLoad,
                    PurchaseOrder   = expectedPurchaseOrder,
                    ShipperNumber   = expectedShipperNumber,
                    Items           = new List <ChileMaterialsReceivedItemParameters>
                    {
                        new ChileMaterialsReceivedItemParameters
                        {
                            Quantity            = 10,
                            PackagingProductKey = packagingProductKey,
                            LocationKey         = locationKey,
                            Variety             = "Variety"
                        }
                    }
                });

                //Assert
                result.AssertSuccess();

                var received = RVCUnitOfWork.ChileMaterialsReceivedRepository.Filter(d => true, d => d.ChileLot.Lot, d => d.Items).Single();

                Assert.AreEqual(expectedLotDate, received.LotDateCreated);
                Assert.AreEqual(expectedLotDateSequence, received.LotDateSequence);
                Assert.AreEqual(expectedLotTypeId, received.LotTypeId);

                Assert.AreEqual(expectedLoad, received.LoadNumber);
                Assert.AreEqual(expectedPurchaseOrder, received.ChileLot.Lot.PurchaseOrderNumber);
                Assert.AreEqual(expectedShipperNumber, received.ChileLot.Lot.ShipperNumber);

                Assert.IsNotNull(received.ChileLot);
                Assert.IsNotNull(received.Items.SingleOrDefault());
            }
Beispiel #19
0
            public override bool Equals(object obj)
            {
                LocationKey l = obj as LocationKey;

                if (l == null)
                {
                    return(false);
                }

                return(l.Country + l.Province == this.Country + this.Province);
            }
Beispiel #20
0
            public void Creates_PickedInventoryItem_records_as_expected()
            {
                //Arrange
                const int quantityPicked0 = 50;
                const int quantityPicked1 = 75;

                var inventory              = TestHelper.CreateObjectGraphAndInsertIntoDatabase <Inventory>(i => i.Quantity = 100);
                var inventoryKey0          = new InventoryKey(inventory);
                var inventoryKey1          = new InventoryKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Inventory>(i => i.Location.ConstrainByKeys(inventory.Location), i => i.Quantity = 100));
                var destinationLocationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>(l => l.ConstrainByKeys(inventory.Location.Facility)));

                //Act
                var result = Service.CreateIntraWarehouseOrder(new CreateIntraWarehouseOrderParameters
                {
                    UserToken           = TestUser.UserName,
                    TrackingSheetNumber = 123.1m,
                    OperatorName        = "Oh operator",
                    MovementDate        = new DateTime(2012, 3, 29),
                    PickedItems         = new List <IIntraWarehouseOrderPickedItemParameters>
                    {
                        new IntraWarehouseOrderPickedItemParameters
                        {
                            InventoryKey           = inventoryKey0.KeyValue,
                            DestinationLocationKey = destinationLocationKey,
                            Quantity = quantityPicked0
                        },
                        new IntraWarehouseOrderPickedItemParameters
                        {
                            InventoryKey           = inventoryKey1.KeyValue,
                            DestinationLocationKey = destinationLocationKey,
                            Quantity = quantityPicked1
                        }
                    }
                });

                //Assert
                result.AssertSuccess();
                var orderKey = new IntraWarehouseOrderKey(KeyParserHelper.ParseResult <IIntraWarehouseOrderKey>(result.ResultingObject).ResultingObject);
                var items    = RVCUnitOfWork.IntraWarehouseOrderRepository.FindByKey(orderKey,
                                                                                     i => i.PickedInventory.Items.Select(t => t.FromLocation),
                                                                                     i => i.PickedInventory.Items.Select(t => t.CurrentLocation))
                               .PickedInventory.Items.ToList();

                Assert.AreEqual(2, items.Count);

                var item0 = items.Single(i => inventoryKey0.Equals(new InventoryKey(i, i, i.FromLocation, i, i.ToteKey)));

                Assert.AreEqual(quantityPicked0, item0.Quantity);

                var item1 = items.Single(i => inventoryKey1.Equals(new InventoryKey(i, i, i.FromLocation, i, i.ToteKey)));

                Assert.AreEqual(quantityPicked1, item1.Quantity);
            }
Beispiel #21
0
 public void AddLocation(ItemKey item, ItemScope scope, LocationKey key)
 {
     if (!Data.ContainsKey(item))
     {
         Data[item] = new ItemLocations();
     }
     if (!Data[item].Locations.ContainsKey(scope))
     {
         Data[item].Locations[scope] = new ItemLocation(scope);
     }
     Data[item].Locations[scope].Keys.Add(key);
 }
Beispiel #22
0
 public LocationKey(LocationType Type, int ID, string Text, List <EntityId> Entities, int Quantity, LocationKey Base)
 {
     this.Type     = Type;
     this.ID       = ID;
     this.Text     = Text;
     this.Entities = Entities;
     this.Quantity = Quantity;
     this.Base     = Base;
     if (Base != null && Base.Type != Type)
     {
         throw new Exception($"Bad base {Base} for {Text}");
     }
     this.maxSlots = 1;
 }
            public void Creates_a_single_Inventory_record_with_aggregate_Quantity_for_Items_received_that_reference_the_same_Packaging_WarehouseLocation()
            {
                //Arrange
                var       expectedLotDate         = new DateTime(2012, 3, 29);
                const int expectedLotDateSequence = 1;
                const int expectedLotTypeId       = (int)LotTypeEnum.DeHydrated;
                const int quantity0        = 10;
                const int quantity1        = 21;
                const int expectedQuantity = quantity0 + quantity1;

                var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated));
                var dehydratorKey   = new CompanyKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Dehydrator)));

                var packagingProductKey  = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>());
                var warehouseLocationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>());

                //Act
                var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters
                {
                    UserToken       = TestUser.UserName,
                    DateReceived    = expectedLotDate,
                    ChileProductKey = chileProductKey.KeyValue,
                    SupplierKey     = dehydratorKey.KeyValue,
                    TreatmentKey    = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(),
                    Items           = new List <ChileMaterialsReceivedItemParameters>
                    {
                        new ChileMaterialsReceivedItemParameters
                        {
                            Quantity            = quantity0,
                            Variety             = "Variety",
                            PackagingProductKey = packagingProductKey.KeyValue,
                            LocationKey         = warehouseLocationKey.KeyValue
                        },
                        new ChileMaterialsReceivedItemParameters
                        {
                            Quantity            = quantity1,
                            Variety             = "Variety",
                            PackagingProductKey = packagingProductKey.KeyValue,
                            LocationKey         = warehouseLocationKey.KeyValue
                        }
                    }
                });

                //Assert
                result.AssertSuccess();

                var inventory = RVCUnitOfWork.InventoryRepository.All().Single(i => i.LotDateCreated == expectedLotDate && i.LotDateSequence == expectedLotDateSequence && i.LotTypeId == expectedLotTypeId);

                Assert.AreEqual(expectedQuantity, inventory.Quantity);
            }
        internal static Expression <Func <InventoryTransaction, bool> > ByInventoryKey(IInventoryKey inventoryKey)
        {
            var lot       = new LotKey(inventoryKey).FindByPredicate;
            var location  = new LocationKey(inventoryKey).FindByPredicate;
            var packaging = new PackagingProductKey(inventoryKey).FindByPredicate;
            var treatment = new InventoryTreatmentKey(inventoryKey).FindByPredicate;

            return(Projector <InventoryTransaction> .To(i =>
                                                        lot.Invoke(i.SourceLot) &&
                                                        location.Invoke(i.Location) &&
                                                        packaging.Invoke(i.PackagingProduct) &&
                                                        treatment.Invoke(i.Treatment) &&
                                                        i.ToteKey == inventoryKey.InventoryKey_ToteKey));
        }
Beispiel #25
0
        internal static IResult <PostInventoryShipmentOrderConductor.Parameters> ToParsedParameters(this IPostParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            var orderKeyResult = KeyParserHelper.ParseResult <IInventoryShipmentOrderKey>(parameters.OrderKey);

            if (!orderKeyResult.Success)
            {
                return(orderKeyResult.ConvertTo <PostInventoryShipmentOrderConductor.Parameters>());
            }

            var itemParameters = new List <PostInventoryShipmentOrderConductor.Parameters.Item>();

            foreach (var item in parameters.PickedItemDestinations ?? new IPostItemParameters[0])
            {
                var itemKeyResult = KeyParserHelper.ParseResult <IPickedInventoryItemKey>(item.PickedInventoryItemKey);
                if (!itemKeyResult.Success)
                {
                    return(itemKeyResult.ConvertTo <PostInventoryShipmentOrderConductor.Parameters>());
                }

                LocationKey locationKey = null;
                if (item.DestinationLocationKey != null)
                {
                    var locationKeyResult = KeyParserHelper.ParseResult <ILocationKey>(item.DestinationLocationKey);
                    if (!locationKeyResult.Success)
                    {
                        return(locationKeyResult.ConvertTo <PostInventoryShipmentOrderConductor.Parameters>());
                    }
                    locationKey = new LocationKey(locationKeyResult.ResultingObject);
                }

                itemParameters.Add(new PostInventoryShipmentOrderConductor.Parameters.Item
                {
                    ItemKey        = itemKeyResult.ResultingObject.ToPickedInventoryItemKey(),
                    DestinationKey = locationKey
                });
            }

            return(new SuccessResult <PostInventoryShipmentOrderConductor.Parameters>(new PostInventoryShipmentOrderConductor.Parameters
            {
                Params = parameters,
                InventoryShipmentOrderKey = orderKeyResult.ResultingObject.ToInventoryShipmentOrderKey(),
                ItemParams = itemParameters
            }));
        }
Beispiel #26
0
        public int CompareTo(Number480 other)
        {
            int diff = LocationKey.CompareTo(other.LocationKey);

            if (diff != 0)
            {
                return(diff);
            }
            diff = DomainKey.CompareTo(other.DomainKey);
            if (diff != 0)
            {
                return(diff);
            }
            return(ContentKey.CompareTo(other.ContentKey));
        }
        public ModifyPickedInventoryItemParameters(PickedInventoryItem pickedItem)
        {
            if (pickedItem.CurrentLocation == null)
            {
                throw new ArgumentNullException("Expected pickedItem.CurrentLocation but was null, verify navigational property is being included in selection.");
            }

            PickedInventoryItemKey = new PickedInventoryItemKey(pickedItem);
            InventoryKey           = new InventoryKey(pickedItem, pickedItem, pickedItem, pickedItem, pickedItem.ToteKey);
            CurrentLocationKey     = new LocationKey(pickedItem.CurrentLocation);
            OriginalQuantity       = pickedItem.Quantity;
            CustomerLotCode        = pickedItem.CustomerLotCode;
            CustomerProductCode    = pickedItem.CustomerProductCode;
            NewQuantity            = 0;
        }
        public MoveInventoryCommandParameters(IInventoryKey sourceInventoryKey, ILocationKey destinationWarehouseLocationKey, int moveQuantity)
        {
            if (sourceInventoryKey == null)
            {
                throw new ArgumentNullException("sourceInventoryKey");
            }
            if (destinationWarehouseLocationKey == null)
            {
                throw new ArgumentNullException("destinationWarehouseLocationKey");
            }

            SourceInventoryKey     = new InventoryKey(sourceInventoryKey);
            DestinationLocationKey = new LocationKey(destinationWarehouseLocationKey);
            MoveQuantity           = moveQuantity;
        }
            public void Posts_InterWarehouseOrder()
            {
                //Arrange
                var order = RVCUnitOfWork.InventoryShipmentOrderRepository
                            .Filter(o =>
                                    o.OrderType == InventoryShipmentOrderTypeEnum.InterWarehouseOrder &&
                                    o.ShipmentInformation.Status != ShipmentStatus.Shipped &&
                                    o.PickedInventory.Items.Any(),
                                    o => o.DestinationFacility.Locations,
                                    o => o.PickedInventory.Items)
                            .FirstOrDefault();

                if (order == null)
                {
                    Assert.Inconclusive("Could not find valid InterWarehouseOrder to post.");
                }
                var destinationLocation = new LocationKey(order.DestinationFacility.Locations.First(l => l.LocID != null));


                //Act
                var result = Service.Post(new PostParameters
                {
                    UserToken = TestUser.UserName,
                    OrderKey  = order.ToInventoryShipmentOrderKey(),
                    PickedItemDestinations = order.PickedInventory.Items.Select(i => new PostItemParameters
                    {
                        PickedInventoryItemKey = new PickedInventoryItemKey(i),
                        DestinationLocationKey = destinationLocation
                    })
                });

                result.AssertSuccess();
                var resultString = GetKeyFromConsoleString(ConsoleOutput.PostedOrder);

                //Assert
                result.AssertSuccess();
                MockKillSwitch.Verify(k => k.Engage(), Times.Never());
                var moveNum   = int.Parse(resultString);
                var outgoings = new RioAccessSQLEntities().tblOutgoings.Where(o => o.MoveNum == moveNum).ToList();

                foreach (var item in order.PickedInventory.Items)
                {
                    Assert.IsNotNull(outgoings.Single(o => o.MDetail == item.DetailID.Value && o.Quantity == item.Quantity));
                    Assert.IsNotNull(outgoings.Single(o => o.MDetail == item.DetailID.Value && o.Quantity == -item.Quantity));
                }
            }
            public void Updates_Location_as_expected_on_success()
            {
                //Arrange
                var locationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>());

                //Act
                var parameters = new UpdateLocationParameters
                {
                    UserToken   = TestUser.UserName,
                    LocationKey = locationKey
                };
                var result = Service.UpdateLocation(parameters);

                //Assert
                result.AssertSuccess();
                RVCUnitOfWork.LocationRepository.FindByKey(locationKey).AssertEqual(parameters);
            }