|
@ -1,4 +1,6 @@ |
|
|
using MiniGames.Client.ViewModel; |
|
|
using MiniGames.Client.ViewModel; |
|
|
|
|
|
using MiniGames.Shared.Models; |
|
|
|
|
|
using Moq; |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
@ -12,6 +14,60 @@ namespace MiniGamesTests |
|
|
{ |
|
|
{ |
|
|
public Uno UnoRegeln = new(); |
|
|
public Uno UnoRegeln = new(); |
|
|
|
|
|
|
|
|
|
|
|
private HandKartenModel BeispielHand() |
|
|
|
|
|
{ |
|
|
|
|
|
HandKartenModel HandStapel = new() |
|
|
|
|
|
{ |
|
|
|
|
|
Id = 1, |
|
|
|
|
|
Name = "Andrej", |
|
|
|
|
|
KartenModels = new() |
|
|
|
|
|
{ |
|
|
|
|
|
new KartenModel |
|
|
|
|
|
{ |
|
|
|
|
|
Name = "2 Ziehen", |
|
|
|
|
|
Farbe = "Gelb", |
|
|
|
|
|
Spezial = true |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return HandStapel; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private StapelModel BeispielZiehKarten() |
|
|
|
|
|
{ |
|
|
|
|
|
StapelModel TestStapel = new(); |
|
|
|
|
|
TestStapel.KartenModels = new() |
|
|
|
|
|
{ |
|
|
|
|
|
new KartenModel |
|
|
|
|
|
{ |
|
|
|
|
|
Name = "Retoure", |
|
|
|
|
|
Farbe = "Blau", |
|
|
|
|
|
Spezial = true |
|
|
|
|
|
}, |
|
|
|
|
|
new KartenModel |
|
|
|
|
|
{ |
|
|
|
|
|
Name = "Retoure", |
|
|
|
|
|
Farbe = "Rot", |
|
|
|
|
|
Spezial = true |
|
|
|
|
|
}, |
|
|
|
|
|
new KartenModel |
|
|
|
|
|
{ |
|
|
|
|
|
Name = "Retoure", |
|
|
|
|
|
Farbe = "Gruen", |
|
|
|
|
|
Spezial = true |
|
|
|
|
|
}, |
|
|
|
|
|
new KartenModel |
|
|
|
|
|
{ |
|
|
|
|
|
Name = "Retoure", |
|
|
|
|
|
Farbe = "Gelb", |
|
|
|
|
|
Spezial = true |
|
|
|
|
|
}, |
|
|
|
|
|
}; |
|
|
|
|
|
return TestStapel; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Theory] |
|
|
[Theory] |
|
|
[InlineData("rot", "rot", true)] |
|
|
[InlineData("rot", "rot", true)] |
|
|
[InlineData("blau", "rot", false)] |
|
|
[InlineData("blau", "rot", false)] |
|
@ -32,5 +88,23 @@ namespace MiniGamesTests |
|
|
//assert
|
|
|
//assert
|
|
|
Assert.Equal(_erwartet, erhalten); |
|
|
Assert.Equal(_erwartet, erhalten); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
private void ZiehEineKarteTest() |
|
|
|
|
|
{ |
|
|
|
|
|
//arrange
|
|
|
|
|
|
StapelModel zuFüllend = new(); |
|
|
|
|
|
var beispielStapel = BeispielZiehKarten(); |
|
|
|
|
|
var beispielHand = BeispielHand(); |
|
|
|
|
|
|
|
|
|
|
|
//act
|
|
|
|
|
|
zuFüllend.KartenModels = UnoRegeln.ZiehEineKarte(beispielHand, beispielStapel).KartenModels; |
|
|
|
|
|
|
|
|
|
|
|
var erwartet = beispielStapel.KartenModels.FirstOrDefault(); |
|
|
|
|
|
var erhalten = beispielHand.KartenModels.LastOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
//assert
|
|
|
|
|
|
Assert.Equal(erwartet, erhalten); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |