ADato88
3 years ago
8 changed files with 148 additions and 2 deletions
-
1BlazorSolution/MiniGames/Client/Program.cs
-
12BlazorSolution/MiniGames/Client/ViewModel/IUno.cs
-
18BlazorSolution/MiniGames/Client/ViewModel/Uno.cs
-
16BlazorSolution/MiniGames/Shared/Models/HandKartenModel.cs
-
15BlazorSolution/MiniGames/Shared/Models/KartenModel.cs
-
13BlazorSolution/MiniGames/Shared/Models/StapelModel.cs
-
1BlazorSolution/MiniGamesTests/MiniGamesTests.csproj
-
74BlazorSolution/MiniGamesTests/UnoTest.cs
@ -0,0 +1,12 @@ |
|||
using MiniGames.Shared.Models; |
|||
|
|||
namespace MiniGames.Client.ViewModel |
|||
{ |
|||
public interface IUno |
|||
{ |
|||
StapelModel AblageStabel { get; set; } |
|||
|
|||
bool IstAblageStabelFarbeGleichHand(string ablegeStapelKarte, string neueKarte); |
|||
HandKartenModel ZiehEineKarte(HandKartenModel handStapel, StapelModel stapelModel); |
|||
} |
|||
} |
@ -1,19 +1,33 @@ |
|||
using MiniGames.Shared.Models; |
|||
using System; |
|||
using System.Linq; |
|||
|
|||
namespace MiniGames.Client.ViewModel |
|||
{ |
|||
public class Uno |
|||
public class Uno : IUno |
|||
{ |
|||
public StapelModel AblageStabel { get; set; } |
|||
|
|||
public bool IstAblageStabelFarbeGleichHand(string ablegeStapelKarte, string neueKarte) |
|||
{ |
|||
if (ablegeStapelKarte.Equals(neueKarte)) |
|||
{ |
|||
return true; |
|||
} else |
|||
} |
|||
else |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public HandKartenModel ZiehEineKarte(HandKartenModel handStapel, StapelModel stapelModel) |
|||
{ |
|||
HandKartenModel _handStapel = handStapel; |
|||
StapelModel _stapelModel = stapelModel; |
|||
|
|||
_handStapel.KartenModels.Add(_stapelModel.KartenModels.FirstOrDefault()); |
|||
|
|||
return _handStapel; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace MiniGames.Shared.Models |
|||
{ |
|||
public class HandKartenModel |
|||
{ |
|||
public int Id { get; set; } |
|||
public string Name { get; set; } |
|||
|
|||
public List<KartenModel> KartenModels { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace MiniGames.Shared.Models |
|||
{ |
|||
public class KartenModel |
|||
{ |
|||
public string Name { get; set; } |
|||
public string Farbe { get; set; } |
|||
public bool Spezial { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace MiniGames.Shared.Models |
|||
{ |
|||
public class StapelModel |
|||
{ |
|||
public List<KartenModel> KartenModels { get; set;} |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue