예제 #1
0
        public void UpdateComponentQuantityByName_test()
        {
            var componentName = "ZZZ - Dummy Component";
            var sut           = new AirtableItemLookup();

            var retrievedcomponent = sut.GetComponentByName(componentName);
            var originalQuantity   = retrievedcomponent.Quantity;
            var originalPending    = retrievedcomponent.Pending;

            sut.UpdateComponentQuantityByName(componentName, 4, 10);
            retrievedcomponent = sut.GetComponentByName(componentName);

            Assert.Equal(retrievedcomponent.Quantity, originalQuantity + 4);
            Assert.Equal(retrievedcomponent.Pending, originalPending - 10);
        }
예제 #2
0
        public void UpdateComponentForInventoryRequest_test()
        {
            var componentName = "Clock Kit (small)";
            var sut           = new AirtableItemLookup();

            var retrievedcomponent = sut.GetComponentByName(componentName);

            var originalQuantity = retrievedcomponent.Quantity;
            var originalPending  = retrievedcomponent.Pending;

            sut.LogInventoryRequestCreation(retrievedcomponent, retrievedcomponent.NumberOfBatches * retrievedcomponent.BatchSize);
            retrievedcomponent = sut.GetComponentByName(componentName);

            Assert.Equal(originalQuantity, retrievedcomponent.Quantity);
            Assert.Equal(originalPending + retrievedcomponent.NumberOfBatches * retrievedcomponent.BatchSize, retrievedcomponent.Pending);
        }
예제 #3
0
        public void CompleteInventoryRequestOrder()
        {
            var inventoryBase = new AirtableItemLookup();

            var test             = new Automation();
            var component        = inventoryBase.GetComponentByName("ZZZ - Dummy", false);
            var previousQuantity = component.Quantity;
            var previousPending  = component.Pending;

            test.CompleteInventoryRequest(component.id, 3, 5);
            inventoryBase.UpdateComponentRecord(component);

            component = inventoryBase.GetComponentByName("ZZZ - Dummy", false);
            Assert.True(component.Quantity - previousQuantity == 3);
            Assert.True(component.Pending - previousPending == -5);
        }
예제 #4
0
        public void ItemInventory()
        {
            var materials        = new AirtableItemLookup();
            var components       = new List <InventoryComponent>();
            var product          = materials.FindItemRecord("zzz - dummy item", "purple", 6);
            var componentData    = materials.GetComponentByName("ZZZ - Dummy Component");
            var originalQuantity = componentData.Quantity;

            bool value = materials.UpdateInventoryCountForTransaction(product, 10, out components);

            Assert.Single(components);
            Assert.Equal("ZZZ - Dummy Component", components[0].Name);

            componentData = materials.GetComponentByName("ZZZ - Dummy Component");

            Assert.Equal(originalQuantity - 10, componentData.Quantity);

            //   Assert.Equal(componentData.IsBelowThreshhold())
        }
예제 #5
0
        public void FindInventoryLocationEntry()
        {
            var inventoryLookup = new AirtableInventory();
            var item            = new AirtableItemLookup();
            var component       = item.GetComponentByName("Clitoris, Gold");

            // var recordID = inventoryLookup.FindRecordByName("Lamp Base", "fgdfg");
            // inventoryLookup.IncrementQuantityOfItemByName("Blocking Board, Purple, 9\"", "James", 5);
            inventoryLookup.IncrementQuantityOfItem(component.id, "James English", 5);
        }
예제 #6
0
        public void CreateInventoryRequestOrder()
        {
            var inventoryBase = new AirtableItemLookup();

            var test             = new Automation();
            var component        = inventoryBase.GetComponentByName("ZZZ - Dummy", false);
            var previousQuantity = component.Quantity;
            var previousPending  = component.Pending;

            test.GenerateInventoryRequest(component, 3);
            Assert.Equal(component.Quantity, previousQuantity);
            Assert.True(component.Pending - previousPending == 3);
            previousPending = component.Pending;

            test.GenerateInventoryRequest(component);
            component = inventoryBase.GetComponentByName("ZZZ - Dummy", false);
            Assert.Equal(component.Quantity, previousQuantity);
            Assert.True(component.Pending - previousPending == component.NumberOfBatches * component.BatchSize);
        }
예제 #7
0
        public void CreateInventoryRequestOrderForLocation()
        {
            var inventoryBase = new AirtableItemLookup();

            var test             = new Automation();
            var component        = inventoryBase.GetComponentByName("ZZZ - Dummy", false);
            var previousQuantity = component.Quantity;
            var previousPending  = component.Pending;

            test.GenerateInventoryRequestByLocation(component, 3, "James English");
        }
예제 #8
0
        public static bool CreateManualInventoryOrder(NameValueCollection fields)
        {
            var inventoryBase = new AirtableItemLookup();
            var auto          = new Automation();
            var component     = inventoryBase.GetComponentByName(fields["Item Name"], false);

            if (component != null)
            {
                auto.GenerateInventoryRequestByLocation(component, int.Parse(fields["Quantity"]), fields["Destination"]);
                return(true);
            }
            return(false);
        }
예제 #9
0
        public void GetInventoryItem()
        {
            var materials = new AirtableItemLookup();
            var product   = materials.FindItemRecord("zzz - dummy item");
            var component = materials.GetComponentByName("ZZZ - Dummy Component");

            Assert.Equal("Dummy Item (test)", product.DisplayName);
            Assert.Equal("www.dummyurl.com", product.BaseUrl);

            List <string> printers;
            string        preferredPrinter;
            bool          value = materials.GetPotentialPrintersList(product, out printers, out preferredPrinter);

            value            = materials.GetPreferredShipper(product, out string preferredShipper);
            preferredPrinter = materials.GetPreferredPrinter(product);
            Assert.True(printers.Count > 0);
            Assert.Equal("Kyle Perkuhn", preferredPrinter);
            value            = materials.GetPotentialPrintersList(component, out printers, out preferredPrinter);
            preferredPrinter = materials.GetPreferredPrinter(component);

            Assert.True(printers.Count > 0);
            Assert.Equal("Al Billington", preferredPrinter);
        }