Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CommBank-Server/CommBank.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="MongoDB.Driver" Version="2.18.0" />
<PackageReference Include="MongoDB.Driver" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions CommBank-Server/Models/Goal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class Goal

public string? Name { get; set; }

public string? Icon { get; set; }

public UInt64 TargetAmount { get; set; } = 0;

public DateTime TargetDate { get; set; }
Expand Down
18 changes: 16 additions & 2 deletions CommBank.Tests/GoalControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,23 @@ public async void Get()
public async void GetForUser()
{
// Arrange

var goals = collections.GetGoals();
var users = collections.GetUsers();
IGoalsService goalsService = new FakeGoalsService(goals, goals[0]);
IUsersService usersService = new FakeUsersService(users, users[0]);
GoalController controller = new(goalsService, usersService);

// Act

var httpContext = new Microsoft.AspNetCore.Http.DefaultHttpContext();
controller.ControllerContext.HttpContext = httpContext;
var result = await controller.GetForUser(goals[0].UserId!);

// Assert
Assert.NotNull(result);
foreach (Goal goal in result!)
{
Assert.IsAssignableFrom<Goal>(goal);
Assert.Equal(goals[0].UserId, goal.UserId);
}
}
}