Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void GIVEN_ConjuredItem_WHEN_Processed_THEN_QualityShouldDecreaseBy2()
        {
            // arrange
            const string expected = "Conjured Item 2 2";
            var          item     = new Item("Conjured Item", 3, 4);

            // act
            var svc    = new ProcessConjuredItem();
            var actual = svc.Execute(item);

            // assert
            actual.Should().BeEquivalentTo(expected);
        }
Esempio n. 3
0
        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>();
        }