public static void Main(string[] args) { System.Console.WriteLine("OMGHAI!"); IList<Item> items = new List<Item> { new Item { Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20 }, new Item { Name = "Aged Brie", SellIn = 2, Quality = 0 }, new Item { Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7 }, new Item { Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80 }, new Item { Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 15, Quality = 20 }, new Item { Name = "Conjured Mana Cake", SellIn = 3, Quality = 6 } }; var guildedRose = new GildedRose(items); for (int i = 0; i < 31; i++) { System.Console.WriteLine("-------- jour " + i + " --------"); System.Console.WriteLine("name, sellIn, quality"); for (int j = 0; j < items.Count; j++) { System.Console.WriteLine(items[j].Name + ", " + items[j].SellIn + ", " + items[j].Quality); } System.Console.WriteLine(""); guildedRose.UpdateQuality(); System.Console.ReadKey(); } System.Console.ReadKey(); }
public void AgeOurStandardInventoryForSeveralMonthsAndVerifyEachDaysResults() { var testSubject = new GildedRose(); var log = new StringBuilder(); for (var i = 0; i < 50; i++) { this.Dump(testSubject, log, i); testSubject.UpdateQuality(); } this.Dump(testSubject, log, 50); Approvals.Verify(log.ToString()); }
public static void Main(string[] args) { System.Console.WriteLine("OMGHAI!"); var app = new GildedRose(new GildedRoseWebService()); for (var i = 0; i < 31; i++) { System.Console.WriteLine("-------- day " + i + " --------"); app.PrintReport(); app.UpdateQuality(); } }
public void updateQuality_SellinEvenAndLessThanZero_QualityDecreaseByFour() { //Arrange Item[] items = new Item[] { new Item{Name = "Suspicious Wooden shield", SellIn=-2, Quality = 20} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Suspicious Wooden shield", items[0].Name); Assert.Equal(-3, items[0].SellIn); Assert.Equal(16, items[0].Quality); }
public void updateQuality_SellinEqualsZeroAndQualityEqualsThree_QualityToZero() { //Arrange Item[] items = new Item[] { new Item{Name = "Suspicious Wooden shield", SellIn=0, Quality = 3} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Suspicious Wooden shield", items[0].Name); Assert.Equal(-1, items[0].SellIn); Assert.Equal(0, items[0].Quality); }
public void updateQuality_SellinBetweenSixAndTen_QualityIncreaseByTwo() { //Arrange Item[] items = new Item[] { new Item{Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 6,Quality = 20} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Backstage passes to a TAFKAL80ETC concert", items[0].Name); Assert.Equal(5, items[0].SellIn); Assert.Equal(22, items[0].Quality); }
public void updateQuality_QualityEqualsFifty_QualityUnchanged() { //Arrange Item[] items = new Item[] { new Item{Name = "Aged Brie", SellIn = 10, Quality = 50} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Aged Brie", items[0].Name); Assert.Equal(9, items[0].SellIn); Assert.Equal(50, items[0].Quality); }
public void updateQuality_QualityEqualsZero_QualityUnchanged() { //Arrange Item[] items = new Item[] { new Item{Name = "+5 Dexterity Vest", SellIn = 10, Quality = 0} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("+5 Dexterity Vest", items[0].Name); Assert.Equal(9, items[0].SellIn); Assert.Equal(0, items[0].Quality); }
public void updateQuality_SellinGreterThanZero_QualityDecreaseByTwo() { //Arrange Item[] items = new Item[] { new Item{Name = "Conjured Mana Cake", SellIn=10, Quality = 20} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Conjured Mana Cake", items[0].Name); Assert.Equal(9, items[0].SellIn); Assert.Equal(18, items[0].Quality); }
public void updateQuality_QualityEqualsFifty_QualityDecreaseByOne() { //Arrange Item[] items = new Item[] { new Item{Name = "+5 Dexterity Vest", SellIn = 10, Quality = 50} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("+5 Dexterity Vest", items[0].Name); Assert.Equal(9, items[0].SellIn); Assert.Equal(49, items[0].Quality); }
public void updateQuality_QualityEqualsThree_QualityToZero() { //Arrange Item[] items = new Item[] { new Item{Name = "Conjured Mana Cake", SellIn=0, Quality = 3} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Conjured Mana Cake", items[0].Name); Assert.Equal(-1, items[0].SellIn); Assert.Equal(0, items[0].Quality); }
public void updateQuality_SellinEqualsZero_QualityDecreaseByFour() { //Arrange Item[] items = new Item[] { new Item{Name = "Conjured Mana Cake", SellIn=0, Quality = 20} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Conjured Mana Cake", items[0].Name); Assert.Equal(-1, items[0].SellIn); Assert.Equal(16, items[0].Quality); }
public void updateQuality_SellinGreterThanZero_QualityUnchanged() { //Arrange Item[] items = new Item[] { new Item{Name = "Sulfuras, Hand of Ragnaros", SellIn = 10, Quality = 20} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Sulfuras, Hand of Ragnaros", items[0].Name); Assert.Equal(10, items[0].SellIn); Assert.Equal(20, items[0].Quality); }
public void updateQuality_QualityEqualsFortyNine_QualityToFifty() { //Arrange Item[] items = new Item[] { new Item{Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 5, Quality = 49} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Backstage passes to a TAFKAL80ETC concert", items[0].Name); Assert.Equal(4, items[0].SellIn); Assert.Equal(50, items[0].Quality); }
public void updateQuality_QualityEqualsZero_QualityIncreaseByOne() { //Arrange Item[] items = new Item[] { new Item{Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 11, Quality = 0} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Backstage passes to a TAFKAL80ETC concert", items[0].Name); Assert.Equal(10, items[0].SellIn); Assert.Equal(1, items[0].Quality); }
public void updateQuality_SellinGreterThanZero_QualityIncreaseByOne() { //Arrange Item[] items = new Item[] { new Item{Name = "Aged Brie", SellIn = 10, Quality = 20} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Aged Brie", items[0].Name); Assert.Equal(9, items[0].SellIn); Assert.Equal(21, items[0].Quality); }
public void updateQuality_SellinLessThanZero_QualityDecreaseByTwo() { //Arrange Item[] items = new Item[] { new Item{Name = "+5 Dexterity Vest", SellIn = -1, Quality = 20} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("+5 Dexterity Vest", items[0].Name); Assert.Equal(-2, items[0].SellIn); Assert.Equal(18, items[0].Quality); }
public void AgedBrieItem_SellGreaterThan0_QualityUpgradeNormally() { //--Arrange IList<Item> Items = new List<Item> { new Item {Name = "Aged Brie", SellIn = 5, Quality = 10 } }; var app = new GildedRose(Items); //--Act app.UpdateQuality(); //--Assert Assert.AreEqual(4, Items[0].SellIn); Assert.AreEqual(11, Items[0].Quality); }
public void AgedBrieItem_SellLowerThan0_QualityMoreThan50_QualityMaxAt50() { //--Arrange IList<Item> Items = new List<Item> { new Item {Name = "Aged Brie", SellIn = -10, Quality = 60 } }; var app = new GildedRose(Items); //--Act app.UpdateQuality(); //--Assert Assert.AreEqual(-11, Items[0].SellIn); Assert.AreEqual(60, Items[0].Quality); }
public void AgedBrieItem_SellInAt0_QualityUpgradeDoubled() { //--Arrange IList<Item> Items = new List<Item> { new Item {Name = "Aged Brie", SellIn = 0, Quality = 10 } }; var app = new GildedRose(Items); //--Act app.UpdateQuality(); //--Assert Assert.AreEqual(-1, Items[0].SellIn); Assert.AreEqual(12, Items[0].Quality); }
public void Test_aged_brie_quality_exceeded() { var items = new[] { new Item() { Name = "Aged Brie", SellIn = 10, Quality = 50 } }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); items[0].Quality.Should().Be(50); }
public void Quality_is_never_more_than_50() { IList <Item> Items = new List <Item> { new Item { Name = "Aged Brie", SellIn = 9, Quality = 50 }, new Item { Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 5, Quality = 49 } }; GildedRose app = new GildedRose(Items); app.UpdateQuality(); Assert.Equal(50, Items[0].Quality); Assert.Equal(50, Items[1].Quality); }
public void increase_aged_brie_quality_as_sellin_date_decreases() { var item = new Item { Name = "Aged Brie", Quality = 1, SellIn = 5 }; var gr = new GildedRose(new List <Item> { item }); gr.UpdateQuality(); Assert.Equal(2, item.Quality); }
public void not_decrease_quality_below_zero() { var item = new Item { Name = "Fact", Quality = 0, SellIn = 0 }; var gr = new GildedRose(new List <Item> { item }); gr.UpdateQuality(); Assert.Equal(0, item.Quality); }
decrements_quality_twice_as_fast_when_sellIn_has_passed() { Item anyItem = ItemBuilder.Create() .WithName("foo") .WithSellIn(0) .WithQuality(2) .Build(); IList <Item> Items = new List <Item> { anyItem }; GildedRose app = new GildedRose(Items); app.UpdateQuality(); Items[0].Quality.Should().Be(0); }
public void increase_the_quality_of_aged_brie_in_one_when_its_gets_older() { var agedBrie = Builder.Item.WithName("Aged Brie") .WithQuality(49) .Build(); var items = new List <Item>() { agedBrie }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); agedBrie.Quality.Should().Be(50); }
public void SulfurasQualityEightyUpdate() { // Given var items = new List <Item> { new Item { Name = "Sulfuras, Hand of Ragnaros", SellIn = 10, Quality = 80 } }; GildedRose app = new GildedRose(items); // When app.UpdateQuality(); // Assert items[0].SellIn.Should().Be(10); items[0].Quality.Should().Be(80); }
public void AgedBrieQualityFiftyUpdate() { // Given var items = new List <Item> { new Item { Name = "Aged Brie", SellIn = 10, Quality = 50 } }; GildedRose app = new GildedRose(items); // When app.UpdateQuality(); // Assert items[0].SellIn.Should().Be(9); items[0].Quality.Should().Be(50); }
public void decrease_by_one_the_sell_in_of_normal_items() { var genericItem = Builder.Item.WithName("foo") .WithSellIn(1) .Build(); var items = new List <Item>() { genericItem }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); genericItem.SellIn.Should().Be(0); }
public void BackStagePassAtSellInZeroDayUpdate() { // Given var items = new List <Item> { new Item { Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 0, Quality = 10 } }; GildedRose app = new GildedRose(items); // When app.UpdateQuality(); // Assert items[0].SellIn.Should().Be(-1); items[0].Quality.Should().Be(0); }
public void Test_aged_brie_sell_in() { var items = new[] { new Item() { Name = "Aged Brie", SellIn = 10, Quality = 2 } }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); items[0].SellIn.Should().Be(9); }
public void not_allow_that_the_quality_on_an_item_will_be_negative() { var normalItem = Builder.Item.WithName("foo") .WithQuality(0) .Build(); var items = new List <Item>() { normalItem }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); normalItem.Quality.Should().Be(0); }
public void not_increase_the_quality_of_an_backstage_more_than_fifty() { var backstage = Builder.Item.WithName("Backstage passes to a TAFKAL80ETC concert") .WithQuality(50) .Build(); var items = new List <Item>() { backstage }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); backstage.Quality.Should().Be(50); }
public void Test_regular_sell_in_passed() { var items = new[] { new Item() { Name = "bread", SellIn = 0, Quality = 40 } }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); items[0].Quality.Should().Be(38); }
public void Test_backstage_sell_in() { var items = new[] { new Item() { Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 6, Quality = 40 } }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); items[0].SellIn.Should().Be(5); }
public void Test_backstage_quality_exceeded() { var items = new[] { new Item() { Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 5, Quality = 49 } }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); items[0].Quality.Should().Be(50); }
public void Test_backstage_quality_triple_increase() { var items = new[] { new Item() { Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 2, Quality = 40 } }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); items[0].Quality.Should().Be(43); }
public void Test_regular_quality_negative() { var items = new[] { new Item() { Name = "bread", SellIn = 0, Quality = 0 } }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); items[0].Quality.Should().Be(0); }
public void decrease_the_quality_of_conjured_twice_as_fast_as_normal_items() { var conjured = Builder.Item.WithName("Conjured Mana Cake") .WithQuality(2) .Build(); var items = new List <Item>() { conjured }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); conjured.Quality.Should().Be(0); }
public void not_increase_the_quality_of_aged_brie_more_than_fifty() { var agedBrie = Builder.Item.WithName("Aged Brie") .WithQuality(50) .Build(); var items = new List <Item>() { agedBrie }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); agedBrie.Quality.Should().Be(50); }
public void CheckLegendarySellIn() { IList <BaseItem> items = new List <BaseItem> { new Legendary { Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80 }, new Legendary { Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80 }, }; GildedRose app = new GildedRose(items); app.UpdateQuality(); Assert.AreEqual(items[0].SellIn, -1); Assert.AreEqual(items[1].SellIn, 0); }
public void decrease_by_one_the_quality_of_normal_items() { var normalItem = Builder.Item.WithName("foo") .WithQuality(1) .Build(); var items = new List <Item>() { normalItem }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); normalItem.Quality.Should().Be(0); }
public void ShouldDecreaseBothValues() { const int startSellIn = 10; const int startQuality = 10; var item = new Item { Name = "+5 Dexterity Vest", SellIn = startSellIn, Quality = startQuality }; var app = new GildedRose(new List <Item> { item }); app.UpdateQuality(); Assert.Equal("+5 Dexterity Vest", item.Name); Assert.Equal(startSellIn - 1, item.SellIn); Assert.Equal(startQuality - 1, item.Quality); }
public void After_daily_update_Quality_value_for_ordinary_items_goes_down_by_one() { // Arrange int initial_quality_value_01 = _test_ordinary_item_01.Quality; int initial_quality_value_02 = _test_ordinary_item_02.Quality; IList <IItem> self_managing_items = new List <IItem> { _test_ordinary_item_01, _test_ordinary_item_02 }; GildedRose app = new GildedRose(self_managing_items); // Act app.UpdateQuality(); // Assert Assert.AreEqual(initial_quality_value_01 - 1, self_managing_items[0].Quality); Assert.AreEqual(initial_quality_value_02 - 1, self_managing_items[1].Quality); }
public void AgedBrieAfterSellDateUpdate() { // Given var items = new List <Item> { new Item { Name = "Aged Brie", SellIn = 0, Quality = 10 } }; GildedRose app = new GildedRose(items); // When app.UpdateQuality(); // Assert items[0].SellIn.Should().Be(-1); items[0].Quality.Should().Be(12); }
public void DefaultItemUpdate() { // Given var items = new List <Item> { new Item { Name = "default_item", SellIn = 10, Quality = 10 } }; GildedRose app = new GildedRose(items); // When app.UpdateQuality(); // Assert items[0].SellIn.Should().Be(9); items[0].Quality.Should().Be(9); }
public void ConjuredItemQualityZeroUpdate() { // Given var items = new List <Item> { new Item { Name = "Conjured Mana Cake", SellIn = 10, Quality = 0 } }; GildedRose app = new GildedRose(items); // When app.UpdateQuality(); // Assert items[0].SellIn.Should().Be(9); items[0].Quality.Should().Be(0); }
public void Test_sulfuras_sell_in_unvariated() { var items = new[] { new Item() { Name = "Sulfuras, Hand of Ragnaros", SellIn = 10, Quality = 40 } }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); items[0].SellIn.Should().Be(10); }
public void not_change_the_quality_of_sulfuras() { var sulfuras = Builder.Item.WithName("Sulfuras, Hand of Ragnaros") .WithQuality(1) .Build(); var items = new List <Item>() { sulfuras }; var gildedRose = new GildedRose(items); gildedRose.UpdateQuality(); sulfuras.Quality.Should().Be(1); }
public void lower_quality_twice_as_fast_after_sell_by() { var item = new Item { Name = "Fact", Quality = 3, SellIn = 0 }; var gr = new GildedRose(new List <Item> { item }); gr.UpdateQuality(); Assert.Equal(1, item.Quality); }
public void updateQuality_SellinEvenAndQualityEqualsFifty_QualityDecreaseByTwo() { //Arrange Item[] items = new Item[] { new Item{Name = "Suspicious Wooden shield", SellIn=10, Quality = 50} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Suspicious Wooden shield", items[0].Name); Assert.Equal(9, items[0].SellIn); Assert.Equal(48, items[0].Quality); }
public void updateQuality_SellinOddAndQualityEqualsZero_QualityUnchanged() { //Arrange Item[] items = new Item[] { new Item{Name = "Suspicious Wooden shield", SellIn=9, Quality = 0} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Suspicious Wooden shield", items[0].Name); Assert.Equal(8, items[0].SellIn); Assert.Equal(0, items[0].Quality); }
public void RegularItem_SellInGreaterThan0_QualityDegradeNormally() { //--Arrange IList<Item> Items = new List<Item> { new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20 } }; var app = new GildedRose(Items); //--Act app.UpdateQuality(); //--Assert Assert.AreEqual(9, Items[0].SellIn); Assert.AreEqual(19, Items[0].Quality); }
public void LegendaryItem_SellInAt0_QualityDontChange() { //--Arrange IList<Item> Items = new List<Item> { new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80 } }; var app = new GildedRose(Items); //--Act app.UpdateQuality(); //--Assert Assert.AreEqual(0, Items[0].SellIn); Assert.AreEqual(80, Items[0].Quality); }
public void updateQuality_SellinEqualsZero_QualityToZero() { //Arrange Item[] items = new Item[] { new Item{Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 0, Quality = 20} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Backstage passes to a TAFKAL80ETC concert", items[0].Name); Assert.Equal(-1, items[0].SellIn); Assert.Equal(0, items[0].Quality); }
public void RegularItem_SellInArriveAt0_QualityDegradeDoubled() { //--Arrange IList<Item> Items = new List<Item> { new Item {Name = "+5 Dexterity Vest", SellIn = 0, Quality = 10 } }; var app = new GildedRose(Items); //--Act app.UpdateQuality(); //--Assert Assert.AreEqual(-1, Items[0].SellIn); Assert.AreEqual(8, Items[0].Quality); }
public void updateQuality_SellinEqualsFive_QualityIncreaseByThree() { //Arrange Item[] items = new Item[] { new Item{Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 5, Quality = 20} }; GildedRose app = new GildedRose(items); //Act app.UpdateQuality(); //Assert Assert.Equal("Backstage passes to a TAFKAL80ETC concert", items[0].Name); Assert.Equal(4, items[0].SellIn); Assert.Equal(23, items[0].Quality); }
public void RegularItem_SellInLower0_QualityDegradeMinAt0() { //--Arrange IList<Item> Items = new List<Item> { new Item {Name = "+5 Dexterity Vest", SellIn = -5, Quality = 0 } }; var app = new GildedRose(Items); //--Act app.UpdateQuality(); //--Assert Assert.AreEqual(-6, Items[0].SellIn); Assert.AreEqual(0, Items[0].Quality); }
public void Foo() { //--Arrange IList<Item> Items = new List<Item> { new Item {Name = "foo", SellIn = 0, Quality = 0} }; var app = new GildedRose(Items); //--Act app.UpdateQuality(); //--Assert Assert.AreEqual("foo", Items[0].Name); }
public void BackstagePass_SellInAt0_QualityUpgradeThrice() { //--Arrange IList<Item> Items = new List<Item> { new Item {Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 1, Quality = 10 } }; var app = new GildedRose(Items); //--Act app.UpdateQuality(); //--Assert Assert.AreEqual(0, Items[0].SellIn); Assert.AreEqual(13, Items[0].Quality); }