diff --git a/src/Client/Features/FreeAgents/Detail.razor b/src/Client/Features/FreeAgents/Detail.razor
index a025a62..92ef263 100644
--- a/src/Client/Features/FreeAgents/Detail.razor
+++ b/src/Client/Features/FreeAgents/Detail.razor
@@ -29,7 +29,7 @@ else
@_result.Name
- Team Owner
+ Former Team
@_result.Team
Position
@_result.Position
@@ -60,15 +60,35 @@ else
var firstBid = _result.Bids.First();
}
-
- @firstBid!.Team is winning with a bid of @firstBid.Amount on @(firstBid.CreatedOn)!
-
+
+
+ @firstBid.Amount
+
+
+
+
+ @firstBid.Team
+
+
+ @firstBid.CreatedOn
+
+
@foreach(var bid in _result.Bids.Skip(1))
{
-
+
+
+
+ @bid.Amount
+
+
- @bid!.Team bid @bid.Amount on @(bid.CreatedOn).
+
+ @bid.Team
+
+
+ @bid.CreatedOn
+
}
diff --git a/src/Server/Features/FreeAgents/Detail.cs b/src/Server/Features/FreeAgents/Detail.cs
index cd644ec..35c5fdd 100644
--- a/src/Server/Features/FreeAgents/Detail.cs
+++ b/src/Server/Features/FreeAgents/Detail.cs
@@ -54,15 +54,6 @@ public async Task Handle(DetailQuery request, Cancellatio
}
}
-public class DetailValidator : AbstractValidator
-{
- public DetailValidator(ApplicationDbContext dbContext)
- {
- RuleFor(p => p.PlayerId)
- .Must(value => dbContext.Players.Any(p => p.Id == value));
- }
-}
-
public class DetailMappingProfile : Profile
{
public DetailMappingProfile()
@@ -74,6 +65,6 @@ public DetailMappingProfile()
CreateMap()
.ForMember(d => d.Team, mo => mo.MapFrom(s => s.Team.Name))
.ForMember(d => d.Amount, mo => mo.MapFrom(s => s.Amount.ToString("C0")))
- .ForMember(d => d.CreatedOn, mo => mo.MapFrom(s => s.CreatedOn.ToShortDateString()));
+ .ForMember(d => d.CreatedOn, mo => mo.MapFrom(s => s.CreatedOn.ToString("g")));
}
}
\ No newline at end of file
diff --git a/src/Server/Infrastructure/SeedDataCommand.cs b/src/Server/Infrastructure/SeedDataCommand.cs
index b65f1b2..95d6f89 100644
--- a/src/Server/Infrastructure/SeedDataCommand.cs
+++ b/src/Server/Infrastructure/SeedDataCommand.cs
@@ -83,33 +83,28 @@ private async Task SeedApplicationDataAsync(CancellationToken cancellationToken)
TeamId = new Random().Next(1, 10)
};
- // TODO: Come back and redo this with the state machine.
- //if (i % 2 == 0)
- //{
- // player.SetToRostered(DateTime.Today.AddYears(1).Year, 1);
-
- // if (i % 10 == 0)
- // {
- // player.SetToUnrostered();
- // }
- //}
- //else if (i % 5 == 0)
- //{
- // player.SetToUnsigned();
- //}
- //else
- //{
- // player.SetToRostered(DateTime.Today.AddYears(-1).Year, 1);
- // if (i % 7 == 0)
- // {
- // player.SetToFreeAgent(DateTime.Today.AddYears(1));
- // }
- // else
- // {
- // player.SetToFreeAgent(DateTime.Today.AddDays(-2));
- // player.TeamId = 1;
- // }
- //}
+
+
+ if (i % 2 == 0)
+ {
+ player.SignForCurrentTeam(DateTime.Today.AddYears(1).Year, i);
+
+
+ if (i % 4 == 0)
+ {
+ player.BeginNewSeason(DateTime.Today.AddYears(1));
+ }
+
+ if (i % 8 == 0)
+ {
+ player.EndBidding();
+ }
+
+ if (i % 16 == 0)
+ {
+ player.ExpireMatch();
+ }
+ }
_dbContext.Players.Add(player);
}
diff --git a/src/Tests/Features/FreeAgents/DetailTests.cs b/src/Tests/Features/FreeAgents/DetailTests.cs
index 1146350..185a065 100644
--- a/src/Tests/Features/FreeAgents/DetailTests.cs
+++ b/src/Tests/Features/FreeAgents/DetailTests.cs
@@ -1,9 +1,12 @@
-using DynamoLeagueBlazor.Shared.Features.FreeAgents;
+using DynamoLeagueBlazor.Client.Features.FreeAgents;
+using DynamoLeagueBlazor.Shared.Features.FreeAgents;
+using Microsoft.Extensions.DependencyInjection;
+using MudBlazor;
using System.Net.Http.Json;
namespace DynamoLeagueBlazor.Tests.Features.FreeAgents;
-public class DetailTests : IntegrationTestBase
+public class DetailServerTests : IntegrationTestBase
{
[Fact]
public async Task GivenUnauthenticatedUser_ThenDoesNotAllowAccess()
@@ -55,3 +58,33 @@ public async Task GivenAnyAuthenticatedUser_WhenGivenValidPlayerId_ThenReturnsEx
DateTime.Parse(bid.CreatedOn).Should().BeExactly(TimeSpan.FromSeconds(0));
}
}
+
+public class DetailClientTests : UITestBase
+{
+ [Fact]
+ public void WhenLoading_ThenShowsLoading()
+ {
+ TestContext!.Services.AddSingleton(Mock.Of());
+
+ GetHttpHandler.When(HttpMethod.Get)
+ .TimesOutAfter(5000);
+
+ var cut = RenderComponent();
+
+ cut.HasComponent().Should().BeTrue();
+ }
+
+ [Fact]
+ public void GivenData_ThenShowsFormAndTimeline()
+ {
+ TestContext!.Services.AddSingleton(Mock.Of());
+
+ GetHttpHandler.When(HttpMethod.Get)
+ .RespondsWithJson(AutoFaker.Generate());
+
+ var cut = RenderComponent();
+
+ cut.HasComponent().Should().BeTrue();
+ cut.HasComponent>().Should().BeTrue();
+ }
+}
diff --git a/src/Tests/Features/Teams/SignPlayerTests.cs b/src/Tests/Features/Teams/SignPlayerTests.cs
index 3216420..83cf81e 100644
--- a/src/Tests/Features/Teams/SignPlayerTests.cs
+++ b/src/Tests/Features/Teams/SignPlayerTests.cs
@@ -61,12 +61,7 @@ public void WhenLoading_ThenShowsSkeleton()
{
// Delay the response.
GetHttpHandler.When(HttpMethod.Get)
- .Respond(async () =>
- {
- await Task.Delay(2000);
-
- return new HttpResponseMessage(HttpStatusCode.OK);
- });
+ .TimesOutAfter(5000);
var component = RenderComponent();
component.HasComponent().Should().BeTrue();