Ejemplo n.º 1
0
        public void ShouldFailBuildComboItemDueToStockQuantity()
        {
            var proxy = new ItemProxy();
            var comboItem = _itemHelper.GetTestComboItem(1, 1);
            var insertResponse = proxy.InsertItem(comboItem);

            var response = proxy.BuildItem(insertResponse.DataObject.InsertedItemId, new BuildComboItem() { Quantity = 1 });

            Assert.IsFalse(response.IsSuccessfull);
            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
            Assert.IsTrue(response.RawResponse.StartsWith("Unable to complete the requested operation as it will cause negative stock-on-hand"));
        }
Ejemplo n.º 2
0
        public void ShouldFailBuildComboItemDueToBadId()
        {
            var proxy = new ItemProxy();

            var response = proxy.BuildItem(-1, new BuildComboItem() { Quantity = 1 });

            Assert.IsFalse(response.IsSuccessfull);
            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
        }
Ejemplo n.º 3
0
        public void ShouldFailBuildComboItemDueToNegativeQuantity()
        {
            var proxy = new ItemProxy();
            var comboItem = _itemHelper.GetTestComboItem(1, 1);
            var insertResponse = proxy.InsertItem(comboItem);

            _itemHelper.InventoryAdjustments(comboItem.BuildItems.Select(s => new Tuple<BuildItem, decimal>(s, 10)).ToList());

            var response = proxy.BuildItem(insertResponse.DataObject.InsertedItemId, new BuildComboItem() { Quantity = -1 });

            Assert.IsFalse(response.IsSuccessfull);
            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
            Assert.IsTrue(response.RawResponse.StartsWith("Unable to complete the requested operation as it will cause negative stock-on-hand"));
        }
Ejemplo n.º 4
0
        public void ShouldBuildComboItem()
        {
            var proxy = new ItemProxy();
            var comboItem = _itemHelper.GetTestComboItem(1,1);
            var insertResponse = proxy.InsertItem(comboItem);

            _itemHelper.InventoryAdjustments(comboItem.BuildItems.Select(s => new Tuple<BuildItem, decimal>(s, 10)).ToList());

            var response = proxy.BuildItem(insertResponse.DataObject.InsertedItemId, new BuildComboItem() {Quantity = 1});

            Assert.IsTrue(response.IsSuccessfull);
            Assert.IsNotNull(response.DataObject);
            Assert.AreEqual("1 combo item(s) have been built.", response.DataObject.StatusMessage);
            Assert.IsNotNull(response.DataObject._links);
            Assert.IsTrue(response.DataObject._links.Count == 2);
        }