mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 12:22:12 +00:00
Added F# starter solution based on .NET Core
This commit is contained in:
parent
a0a860d0fe
commit
7ce7df7c7e
@ -0,0 +1,33 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="GildedRoseTest.ApprovalTest.ThirtyDays.received.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Compile Include="Tests.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\GildedRose\GildedRose.fsproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Update="FSharp.Core" Version="4.6.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,373 @@
|
|||||||
|
OMGHAI!
|
||||||
|
-------- day 0 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 10, 20
|
||||||
|
Aged Brie, 2, 0
|
||||||
|
Elixir of the Mongoose, 5, 7
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 15, 20
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 10, 49
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 5, 49
|
||||||
|
Conjured Mana Cake, 3, 6
|
||||||
|
|
||||||
|
-------- day 1 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 9, 19
|
||||||
|
Aged Brie, 1, 1
|
||||||
|
Elixir of the Mongoose, 4, 6
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 14, 21
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 9, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 4, 50
|
||||||
|
Conjured Mana Cake, 2, 5
|
||||||
|
|
||||||
|
-------- day 2 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 8, 18
|
||||||
|
Aged Brie, 0, 2
|
||||||
|
Elixir of the Mongoose, 3, 5
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 13, 22
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 8, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 3, 50
|
||||||
|
Conjured Mana Cake, 1, 4
|
||||||
|
|
||||||
|
-------- day 3 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 7, 17
|
||||||
|
Aged Brie, -1, 4
|
||||||
|
Elixir of the Mongoose, 2, 4
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 12, 23
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 7, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 2, 50
|
||||||
|
Conjured Mana Cake, 0, 3
|
||||||
|
|
||||||
|
-------- day 4 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 6, 16
|
||||||
|
Aged Brie, -2, 6
|
||||||
|
Elixir of the Mongoose, 1, 3
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 11, 24
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 6, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 1, 50
|
||||||
|
Conjured Mana Cake, -1, 1
|
||||||
|
|
||||||
|
-------- day 5 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 5, 15
|
||||||
|
Aged Brie, -3, 8
|
||||||
|
Elixir of the Mongoose, 0, 2
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 10, 25
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 5, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 0, 50
|
||||||
|
Conjured Mana Cake, -2, 0
|
||||||
|
|
||||||
|
-------- day 6 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 4, 14
|
||||||
|
Aged Brie, -4, 10
|
||||||
|
Elixir of the Mongoose, -1, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 9, 27
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 4, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -1, 0
|
||||||
|
Conjured Mana Cake, -3, 0
|
||||||
|
|
||||||
|
-------- day 7 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 3, 13
|
||||||
|
Aged Brie, -5, 12
|
||||||
|
Elixir of the Mongoose, -2, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 8, 29
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 3, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -2, 0
|
||||||
|
Conjured Mana Cake, -4, 0
|
||||||
|
|
||||||
|
-------- day 8 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 2, 12
|
||||||
|
Aged Brie, -6, 14
|
||||||
|
Elixir of the Mongoose, -3, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 7, 31
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 2, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -3, 0
|
||||||
|
Conjured Mana Cake, -5, 0
|
||||||
|
|
||||||
|
-------- day 9 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 1, 11
|
||||||
|
Aged Brie, -7, 16
|
||||||
|
Elixir of the Mongoose, -4, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 6, 33
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 1, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -4, 0
|
||||||
|
Conjured Mana Cake, -6, 0
|
||||||
|
|
||||||
|
-------- day 10 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, 0, 10
|
||||||
|
Aged Brie, -8, 18
|
||||||
|
Elixir of the Mongoose, -5, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 5, 35
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 0, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -5, 0
|
||||||
|
Conjured Mana Cake, -7, 0
|
||||||
|
|
||||||
|
-------- day 11 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -1, 8
|
||||||
|
Aged Brie, -9, 20
|
||||||
|
Elixir of the Mongoose, -6, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 4, 38
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -1, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -6, 0
|
||||||
|
Conjured Mana Cake, -8, 0
|
||||||
|
|
||||||
|
-------- day 12 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -2, 6
|
||||||
|
Aged Brie, -10, 22
|
||||||
|
Elixir of the Mongoose, -7, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 3, 41
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -2, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -7, 0
|
||||||
|
Conjured Mana Cake, -9, 0
|
||||||
|
|
||||||
|
-------- day 13 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -3, 4
|
||||||
|
Aged Brie, -11, 24
|
||||||
|
Elixir of the Mongoose, -8, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 2, 44
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -3, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -8, 0
|
||||||
|
Conjured Mana Cake, -10, 0
|
||||||
|
|
||||||
|
-------- day 14 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -4, 2
|
||||||
|
Aged Brie, -12, 26
|
||||||
|
Elixir of the Mongoose, -9, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 1, 47
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -4, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -9, 0
|
||||||
|
Conjured Mana Cake, -11, 0
|
||||||
|
|
||||||
|
-------- day 15 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -5, 0
|
||||||
|
Aged Brie, -13, 28
|
||||||
|
Elixir of the Mongoose, -10, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, 0, 50
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -5, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -10, 0
|
||||||
|
Conjured Mana Cake, -12, 0
|
||||||
|
|
||||||
|
-------- day 16 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -6, 0
|
||||||
|
Aged Brie, -14, 30
|
||||||
|
Elixir of the Mongoose, -11, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -1, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -6, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -11, 0
|
||||||
|
Conjured Mana Cake, -13, 0
|
||||||
|
|
||||||
|
-------- day 17 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -7, 0
|
||||||
|
Aged Brie, -15, 32
|
||||||
|
Elixir of the Mongoose, -12, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -2, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -7, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -12, 0
|
||||||
|
Conjured Mana Cake, -14, 0
|
||||||
|
|
||||||
|
-------- day 18 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -8, 0
|
||||||
|
Aged Brie, -16, 34
|
||||||
|
Elixir of the Mongoose, -13, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -3, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -8, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -13, 0
|
||||||
|
Conjured Mana Cake, -15, 0
|
||||||
|
|
||||||
|
-------- day 19 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -9, 0
|
||||||
|
Aged Brie, -17, 36
|
||||||
|
Elixir of the Mongoose, -14, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -4, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -9, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -14, 0
|
||||||
|
Conjured Mana Cake, -16, 0
|
||||||
|
|
||||||
|
-------- day 20 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -10, 0
|
||||||
|
Aged Brie, -18, 38
|
||||||
|
Elixir of the Mongoose, -15, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -5, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -10, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -15, 0
|
||||||
|
Conjured Mana Cake, -17, 0
|
||||||
|
|
||||||
|
-------- day 21 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -11, 0
|
||||||
|
Aged Brie, -19, 40
|
||||||
|
Elixir of the Mongoose, -16, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -6, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -11, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -16, 0
|
||||||
|
Conjured Mana Cake, -18, 0
|
||||||
|
|
||||||
|
-------- day 22 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -12, 0
|
||||||
|
Aged Brie, -20, 42
|
||||||
|
Elixir of the Mongoose, -17, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -7, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -12, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -17, 0
|
||||||
|
Conjured Mana Cake, -19, 0
|
||||||
|
|
||||||
|
-------- day 23 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -13, 0
|
||||||
|
Aged Brie, -21, 44
|
||||||
|
Elixir of the Mongoose, -18, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -8, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -13, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -18, 0
|
||||||
|
Conjured Mana Cake, -20, 0
|
||||||
|
|
||||||
|
-------- day 24 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -14, 0
|
||||||
|
Aged Brie, -22, 46
|
||||||
|
Elixir of the Mongoose, -19, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -9, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -14, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -19, 0
|
||||||
|
Conjured Mana Cake, -21, 0
|
||||||
|
|
||||||
|
-------- day 25 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -15, 0
|
||||||
|
Aged Brie, -23, 48
|
||||||
|
Elixir of the Mongoose, -20, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -10, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -15, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -20, 0
|
||||||
|
Conjured Mana Cake, -22, 0
|
||||||
|
|
||||||
|
-------- day 26 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -16, 0
|
||||||
|
Aged Brie, -24, 50
|
||||||
|
Elixir of the Mongoose, -21, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -11, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -16, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -21, 0
|
||||||
|
Conjured Mana Cake, -23, 0
|
||||||
|
|
||||||
|
-------- day 27 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -17, 0
|
||||||
|
Aged Brie, -25, 50
|
||||||
|
Elixir of the Mongoose, -22, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -12, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -17, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -22, 0
|
||||||
|
Conjured Mana Cake, -24, 0
|
||||||
|
|
||||||
|
-------- day 28 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -18, 0
|
||||||
|
Aged Brie, -26, 50
|
||||||
|
Elixir of the Mongoose, -23, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -13, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -18, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -23, 0
|
||||||
|
Conjured Mana Cake, -25, 0
|
||||||
|
|
||||||
|
-------- day 29 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -19, 0
|
||||||
|
Aged Brie, -27, 50
|
||||||
|
Elixir of the Mongoose, -24, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -14, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -19, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -24, 0
|
||||||
|
Conjured Mana Cake, -26, 0
|
||||||
|
|
||||||
|
-------- day 30 --------
|
||||||
|
name, sellIn, quality
|
||||||
|
+5 Dexterity Vest, -20, 0
|
||||||
|
Aged Brie, -28, 50
|
||||||
|
Elixir of the Mongoose, -25, 0
|
||||||
|
Sulfuras, Hand of Ragnaros, 0, 80
|
||||||
|
Sulfuras, Hand of Ragnaros, -1, 80
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -15, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -20, 0
|
||||||
|
Backstage passes to a TAFKAL80ETC concert, -25, 0
|
||||||
|
Conjured Mana Cake, -27, 0
|
||||||
|
|
||||||
19
fsharp-core/GildedRose.ApprovalTests/Tests.fs
Normal file
19
fsharp-core/GildedRose.ApprovalTests/Tests.fs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
module GildedRose.ApprovalTests
|
||||||
|
|
||||||
|
open System
|
||||||
|
open Xunit
|
||||||
|
open System.Text
|
||||||
|
open System.IO
|
||||||
|
|
||||||
|
[<Fact>]
|
||||||
|
let ``Thirty day report is correct`` () =
|
||||||
|
let expected = File.ReadAllText "GildedRoseTest.ApprovalTest.ThirtyDays.received.txt"
|
||||||
|
|
||||||
|
let fakeoutput = new StringBuilder()
|
||||||
|
Console.SetOut(new StringWriter(fakeoutput))
|
||||||
|
Console.SetIn(new StringReader("a\n"))
|
||||||
|
|
||||||
|
GildedRose.Program.main [||] |> ignore
|
||||||
|
let actual = fakeoutput.ToString()
|
||||||
|
|
||||||
|
Assert.Equal(expected, actual)
|
||||||
31
fsharp-core/GildedRose.UnitTests/GildedRose.UnitTests.fsproj
Normal file
31
fsharp-core/GildedRose.UnitTests/GildedRose.UnitTests.fsproj
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Tests.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0" />
|
||||||
|
<PackageReference Include="Unquote" Version="4.0.0" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\GildedRose\GildedRose.fsproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Update="FSharp.Core" Version="4.6.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
14
fsharp-core/GildedRose.UnitTests/Tests.fs
Normal file
14
fsharp-core/GildedRose.UnitTests/Tests.fs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module GildedRose.UnitTests
|
||||||
|
|
||||||
|
open GildedRose
|
||||||
|
open System.Collections.Generic
|
||||||
|
open Xunit
|
||||||
|
open Swensen.Unquote
|
||||||
|
|
||||||
|
[<Fact>]
|
||||||
|
let ``My test`` () =
|
||||||
|
let Items = new List<Item>()
|
||||||
|
Items.Add({Name = "foo"; SellIn = 0; Quality = 0})
|
||||||
|
let app = new GildedRose(Items)
|
||||||
|
app.UpdateQuality()
|
||||||
|
test <@ "fixme" = Items.[0].Name @>
|
||||||
37
fsharp-core/GildedRose.sln
Normal file
37
fsharp-core/GildedRose.sln
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.28307.421
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GildedRose", "GildedRose\GildedRose.fsproj", "{63814E28-6A6A-4496-BD16-DC1DFD79CDC8}"
|
||||||
|
EndProject
|
||||||
|
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GildedRose.UnitTests", "GildedRose.UnitTests\GildedRose.UnitTests.fsproj", "{34C47A43-9A27-44C0-9CA8-15324A76FD20}"
|
||||||
|
EndProject
|
||||||
|
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GildedRose.ApprovalTests", "GildedRose.ApprovalTests\GildedRose.ApprovalTests.fsproj", "{C2C723A1-31CF-445C-BC8B-3CFC8620C8EB}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{63814E28-6A6A-4496-BD16-DC1DFD79CDC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{63814E28-6A6A-4496-BD16-DC1DFD79CDC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{63814E28-6A6A-4496-BD16-DC1DFD79CDC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{63814E28-6A6A-4496-BD16-DC1DFD79CDC8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{34C47A43-9A27-44C0-9CA8-15324A76FD20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{34C47A43-9A27-44C0-9CA8-15324A76FD20}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{34C47A43-9A27-44C0-9CA8-15324A76FD20}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{34C47A43-9A27-44C0-9CA8-15324A76FD20}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C2C723A1-31CF-445C-BC8B-3CFC8620C8EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C2C723A1-31CF-445C-BC8B-3CFC8620C8EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C2C723A1-31CF-445C-BC8B-3CFC8620C8EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C2C723A1-31CF-445C-BC8B-3CFC8620C8EB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {16C52833-8AA9-469D-88D2-A3C9249ED08F}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
16
fsharp-core/GildedRose/GildedRose.fsproj
Normal file
16
fsharp-core/GildedRose/GildedRose.fsproj
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Update="FSharp.Core" Version="4.6.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
65
fsharp-core/GildedRose/Program.fs
Normal file
65
fsharp-core/GildedRose/Program.fs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
namespace GildedRose
|
||||||
|
|
||||||
|
open System.Collections.Generic
|
||||||
|
|
||||||
|
type Item = { Name: string; SellIn: int; Quality: int }
|
||||||
|
|
||||||
|
type GildedRose(items:IList<Item>) =
|
||||||
|
let Items = items
|
||||||
|
|
||||||
|
member this.UpdateQuality() =
|
||||||
|
for i = 0 to Items.Count - 1 do
|
||||||
|
if Items.[i].Name <> "Aged Brie" && Items.[i].Name <> "Backstage passes to a TAFKAL80ETC concert" then
|
||||||
|
if Items.[i].Quality > 0 then
|
||||||
|
if Items.[i].Name <> "Sulfuras, Hand of Ragnaros" then
|
||||||
|
Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) }
|
||||||
|
else
|
||||||
|
if Items.[i].Quality < 50 then
|
||||||
|
Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) }
|
||||||
|
if Items.[i].Name = "Backstage passes to a TAFKAL80ETC concert" then
|
||||||
|
if Items.[i].SellIn < 11 then
|
||||||
|
if Items.[i].Quality < 50 then
|
||||||
|
Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) }
|
||||||
|
if Items.[i].SellIn < 6 then
|
||||||
|
if Items.[i].Quality < 50 then
|
||||||
|
Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) }
|
||||||
|
if Items.[i].Name <> "Sulfuras, Hand of Ragnaros" then
|
||||||
|
Items.[i] <- { Items.[i] with SellIn = (Items.[i].SellIn - 1) }
|
||||||
|
if Items.[i].SellIn < 0 then
|
||||||
|
if Items.[i].Name <> "Aged Brie" then
|
||||||
|
if Items.[i].Name <> "Backstage passes to a TAFKAL80ETC concert" then
|
||||||
|
if Items.[i].Quality > 0 then
|
||||||
|
if Items.[i].Name <> "Sulfuras, Hand of Ragnaros" then
|
||||||
|
Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) }
|
||||||
|
else
|
||||||
|
Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - Items.[i].Quality) }
|
||||||
|
else
|
||||||
|
if Items.[i].Quality < 50 then
|
||||||
|
Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) }
|
||||||
|
()
|
||||||
|
|
||||||
|
|
||||||
|
module Program =
|
||||||
|
[<EntryPoint>]
|
||||||
|
let main argv =
|
||||||
|
printfn "OMGHAI!"
|
||||||
|
let Items = new List<Item>()
|
||||||
|
Items.Add({Name = "+5 Dexterity Vest"; SellIn = 10; Quality = 20})
|
||||||
|
Items.Add({Name = "Aged Brie"; SellIn = 2; Quality = 0})
|
||||||
|
Items.Add({Name = "Elixir of the Mongoose"; SellIn = 5; Quality = 7})
|
||||||
|
Items.Add({Name = "Sulfuras, Hand of Ragnaros"; SellIn = 0; Quality = 80})
|
||||||
|
Items.Add({Name = "Sulfuras, Hand of Ragnaros"; SellIn = -1; Quality = 80})
|
||||||
|
Items.Add({Name = "Backstage passes to a TAFKAL80ETC concert"; SellIn = 15; Quality = 20})
|
||||||
|
Items.Add({Name = "Backstage passes to a TAFKAL80ETC concert"; SellIn = 10; Quality = 49})
|
||||||
|
Items.Add({Name = "Backstage passes to a TAFKAL80ETC concert"; SellIn = 5; Quality = 49})
|
||||||
|
Items.Add({Name = "Conjured Mana Cake"; SellIn = 3; Quality = 6})
|
||||||
|
|
||||||
|
let app = new GildedRose(Items)
|
||||||
|
for i = 0 to 30 do
|
||||||
|
printfn "-------- day %d --------" i
|
||||||
|
printfn "name, sellIn, quality"
|
||||||
|
for j = 0 to Items.Count - 1 do
|
||||||
|
printfn "%s, %d, %d" Items.[j].Name Items.[j].SellIn Items.[j].Quality
|
||||||
|
printfn ""
|
||||||
|
app.UpdateQuality()
|
||||||
|
0
|
||||||
Loading…
Reference in New Issue
Block a user