コード例 #1
0
        public void GivenAgedBrie_WhenUpdated_QualityIncreases()
        {
            var item = new Item()
            {
                Name = "Aged Brie", Quality = 2, SellIn = 2
            };
            var rule = new AgedBrieUpdateRule();

            rule.Update(item);

            item.Quality.Should().Be(3);
        }
コード例 #2
0
        public void GivenAgedBrie_WhenUpdated_SellinReducesByOne()
        {
            var item = new Item()
            {
                Name = "Aged Brie", Quality = 2, SellIn = 2
            };
            var rule = new AgedBrieUpdateRule();

            rule.Update(item);

            item.SellIn.Should().Be(1);
        }
コード例 #3
0
        public void GivenAgedBrie_SellIn1_Quality1_WhenUpdated_ThenAgedBrie_SellIn0_Quality2_Returned()
        {
            //GIVEN
            var items = new List <Item>()
            {
                new Item()
                {
                    Name = "Aged Brie", SellIn = 1, Quality = 1
                }
            };
            var rule = new AgedBrieUpdateRule();

            _inventoryManagementService = new InventoryManagementService(updateRule => rule);
            //WHEN
            var results = _inventoryManagementService.Update(items);
            //THEN
            var result = results.First();

            result.Should().Be("Aged Brie 0 2");
        }