示例#1
0
        public void GetInventoryService_NoParam_ServiceInjected()
        {
            //Arrange
            var toTest = new ApiInjecter();

            //Act
            var result = toTest.GetInventoryService();
            var item   = result.Take("Whatever"); //This only checks if any error injecting provokes failure

            //Assert
            Assert.IsNotNull(result);

            //Clean. Not needed here but as a good practice
            result.Reset();
        }
示例#2
0
        public void AddNTake_InventoryItem_IsAddedTaken()
        {
            //Arrange
            var apiInjector = new ApiInjecter();
            var toTest      = apiInjector.GetInventoryService();
            var itemToAdd   = new InventoryItem()
            {
                Label = "Some Code", ExpirationDate = new DateTime(2100, 12, 31)
            };

            //Act
            toTest.Add(itemToAdd);
            var result = toTest.Take(itemToAdd.Label);

            //Assert
            Assert.AreEqual(itemToAdd.Label, result.Label);
            Assert.AreEqual(itemToAdd.ExpirationDate, result.ExpirationDate);
            Assert.AreEqual(itemToAdd, result);

            //Clean. Not needed here but as a good practice
            toTest.Reset();
        }