-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#896: Introduce TournamentGameBuilder and Player constants to reduce …
…duplication
- Loading branch information
1 parent
906d034
commit f704285
Showing
2 changed files
with
122 additions
and
137 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
CourageScores.Tests/Models/Cosmos/Game/TournamentGameBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using CourageScores.Models.Cosmos.Game; | ||
using CourageScores.Models.Dtos.Season; | ||
|
||
namespace CourageScores.Tests.Models.Cosmos.Game; | ||
|
||
public class TournamentGameBuilder | ||
{ | ||
private readonly TournamentGame _tournament; | ||
|
||
public TournamentGameBuilder(TournamentGame? tournament = null) | ||
{ | ||
_tournament = tournament ?? new TournamentGame { Id = Guid.NewGuid() }; | ||
} | ||
|
||
public TournamentGame Build() | ||
{ | ||
return _tournament; | ||
} | ||
|
||
public TournamentGameBuilder WithDate(DateTime date) | ||
{ | ||
_tournament.Date = date; | ||
return this; | ||
} | ||
|
||
public TournamentGameBuilder WithSeason(SeasonDto season) | ||
{ | ||
_tournament.SeasonId = season.Id; | ||
return this; | ||
} | ||
|
||
public TournamentGameBuilder WithType(string type) | ||
{ | ||
_tournament.Type = type; | ||
return this; | ||
} | ||
|
||
public TournamentGameBuilder AccoladesCount(bool count = true) | ||
{ | ||
_tournament.AccoladesCount = count; | ||
return this; | ||
} | ||
|
||
public TournamentGameBuilder WithOneEighties(params TournamentPlayer[] players) | ||
{ | ||
_tournament.OneEighties.AddRange(players); | ||
return this; | ||
} | ||
} |
Oops, something went wrong.