public void AcceptanceTest() { // arrange var loggerMoq = new Mock <ILogger <InventoryService> >(); var processAgedBrie = new ProcessAgedBrie(); var processBackStagePass = new ProcessBackStagePass(); var processConjuredItem = new ProcessConjuredItem(); var processInvalidItem = new ProcessInvalidItem(); var processNormalItem = new ProcessNormalItem(); var processSulfurasItem = new ProcessSulfurasItem(); var expected = new List <string> { "Aged Brie 0 2", "Backstage passes -2 0", "Backstage passes 8 4", "Sulfuras 2 2", "Normal Item -2 50", "Normal Item 1 1", "NO SUCH ITEM", "Conjured 1 0", "Conjured -2 1" }; var svc = new InventoryService(loggerMoq.Object, processInvalidItem, processAgedBrie, processBackStagePass, processConjuredItem, processNormalItem, processSulfurasItem); // act var actual = svc.Process(Inventory); // assert actual.Should().BeEquivalentTo(expected); }
public void GIVEN_NormalItem_WHEN_Processed_THEN_QualityShouldDecreaseBy1() { // arrange const string expected = "Normal Item 1 1"; var item = new Item("Normal Item", 2, 2); // act var svc = new ProcessNormalItem(); var actual = svc.Execute(item); // assert actual.Should().BeEquivalentTo(expected); }
public void GIVEN_InventoryService_WHEN_ProcessingWithNullItem_THEN_ThrowsArgumentNullException() { // arrange Item item = null; var loggerMoq = new Mock <ILogger <InventoryService> >(); var processAgedBrie = new ProcessAgedBrie(); var processBackStagePass = new ProcessBackStagePass(); var processConjuredItem = new ProcessConjuredItem(); var processInvalidItem = new ProcessInvalidItem(); var processNormalItem = new ProcessNormalItem(); var processSulfurasItem = new ProcessSulfurasItem(); var svc = new InventoryService(loggerMoq.Object, processInvalidItem, processAgedBrie, processBackStagePass, processConjuredItem, processNormalItem, processSulfurasItem); // act Action act = () => svc.ProcessItem(item); // assert act.Should().Throw <ArgumentNullException>(); }