-
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.
Align existing tests to docs for linking and unlinking player identit…
…ies, and get all tests back to passing #627
- Loading branch information
1 parent
4fcef40
commit b7d35f8
Showing
25 changed files
with
402 additions
and
222 deletions.
There are no files selected for viewing
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
140 changes: 89 additions & 51 deletions
140
Stoolball.Data.SqlServer.IntegrationTests/Statistics/SqlServerPlayerRepositoryTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
+6 Bytes
(100%)
Stoolball.Data.SqlServer.IntegrationTests/StoolballIntegrationTests.dacpac
Binary file not shown.
Binary file modified
BIN
+6 Bytes
(100%)
...SqlServer.IntegrationTests/StoolballStatisticsMaxResultsDataSourceIntegrationTests.dacpac
Binary file not shown.
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
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
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
41 changes: 41 additions & 0 deletions
41
Stoolball.Testing/PlayerDataProviders/PlayersNotLinkedToMembersProvider.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,41 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Bogus; | ||
using Stoolball.Statistics; | ||
using Stoolball.Teams; | ||
using Stoolball.Testing.Fakers; | ||
|
||
namespace Stoolball.Testing.PlayerDataProviders | ||
{ | ||
internal class PlayersNotLinkedToMembersProvider(IFakerFactory<Team> teamFakerFactory, IFakerFactory<Player> playerFakerFactory, IFakerFactory<PlayerIdentity> playerIdentityFakerFactory) : BasePlayerDataProvider | ||
{ | ||
private readonly Faker<Team> _teamFaker = teamFakerFactory.Create(); | ||
private readonly Faker<Player> _playerFaker = playerFakerFactory.Create(); | ||
private readonly Faker<PlayerIdentity> _playerIdentityFaker = playerIdentityFakerFactory.Create(); | ||
|
||
internal override IEnumerable<Player> CreatePlayers(TestData readOnlyTestData) | ||
{ | ||
var team = _teamFaker.Generate(1).Single(); | ||
|
||
// player with a single identity | ||
var playerWithSingleIdentity = _playerFaker.Generate(1).Single(); | ||
playerWithSingleIdentity.PlayerIdentities.Add(_playerIdentityFaker.Generate(1).Single()); | ||
playerWithSingleIdentity.PlayerIdentities[0].Player = playerWithSingleIdentity; | ||
playerWithSingleIdentity.PlayerIdentities[0].Team = team; | ||
playerWithSingleIdentity.PlayerIdentities[0].LinkedBy = PlayerIdentityLinkedBy.DefaultIdentity; | ||
|
||
// player with two identities both linked by team, on the same team, not linked to member | ||
var playerWithTwoIdentitiesLinkedByTeam = _playerFaker.Generate(1).Single(); | ||
playerWithTwoIdentitiesLinkedByTeam.PlayerIdentities.AddRange(_playerIdentityFaker.Generate(2)); | ||
|
||
foreach (var identity in playerWithTwoIdentitiesLinkedByTeam.PlayerIdentities) | ||
{ | ||
identity.Player = playerWithTwoIdentitiesLinkedByTeam; | ||
identity.Team = team; | ||
identity.LinkedBy = PlayerIdentityLinkedBy.Team; | ||
} | ||
|
||
return [playerWithSingleIdentity, playerWithTwoIdentitiesLinkedByTeam]; | ||
} | ||
} | ||
} |
Oops, something went wrong.