This repository has been archived by the owner on Dec 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemBuilder.cs
70 lines (56 loc) · 1.52 KB
/
ItemBuilder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
namespace GildedRose
{
public class ItemBuilder
{
private Item _item = new Item();
public ItemBuilder Quality(int quality)
{
_item.Quality = quality;
return this;
}
public ItemBuilder SellIn(int sellIn)
{
_item.SellIn = sellIn;
return this;
}
public ItemBuilder Normal()
{
_item.Name = "Normal";
_item.SellIn = 10;
_item.Quality = 15;
return this;
}
public ItemBuilder AgedBrie()
{
_item.Name = ItemNames.AgedBrie;
_item.SellIn = 4;
_item.Quality = 10;
return this;
}
public ItemBuilder Sulfuras()
{
_item.Name = ItemNames.Sulfuras;
_item.SellIn = 3;
_item.Quality = 80;
return this;
}
public ItemBuilder BackstagePasses()
{
_item.Name = ItemNames.BackstagePasses;
_item.SellIn = 20;
_item.Quality = 3;
return this;
}
public ItemBuilder Conjured()
{
_item.Name = $"{ItemNames.Conjured} {_item.Name}";
_item.SellIn = 13;
_item.Quality = 10;
return this;
}
public ItemBuilder NoQuality() => Quality(0);
public ItemBuilder MaxQuality() => Quality(50);
public ItemBuilder SellInExpired() => SellIn(0);
public Item Build() => _item;
}
}