public async Task TestAddStock()
        {
            int expectedQuantity = 10;
            int quantityToAdd = 3;
            MockReliableStateManager stateManager = new MockReliableStateManager();
            InventoryService target = new InventoryService(statefulServiceContext, stateManager);

            InventoryItem item = new InventoryItem("test", 1, expectedQuantity - quantityToAdd, 1, expectedQuantity);

            RestockRequest.Domain.RestockRequest request = new RestockRequest.Domain.RestockRequest(item.Id, quantityToAdd);

            await target.CreateInventoryItemAsync(item);
            int actualAdded = await target.AddStockAsync(request.ItemId, quantityToAdd);

            Assert.AreEqual(quantityToAdd, actualAdded);
            Assert.AreEqual(item.AvailableStock, expectedQuantity);
        }
Ejemplo n.º 2
0
        public async Task TestAddStock()
        {
            int expectedQuantity = 10;
            int quantityToAdd    = 3;
            MockReliableStateManager stateManager = new MockReliableStateManager();
            InventoryService         target       = new InventoryService(statefulServiceContext, stateManager);

            InventoryItem item = new InventoryItem("test", 1, expectedQuantity - quantityToAdd, 1, expectedQuantity);

            RestockRequest.Domain.RestockRequest request = new RestockRequest.Domain.RestockRequest(item.Id, quantityToAdd);

            await target.CreateInventoryItemAsync(item);

            int actualAdded = await target.AddStockAsync(request.ItemId, quantityToAdd);

            Assert.AreEqual(quantityToAdd, actualAdded);
            Assert.AreEqual(item.AvailableStock, expectedQuantity);
        }