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/Secrets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
"CommBank": "{CONNECTION_STRING}"
"CommBank": "mongodb+srv://adminUser:Test12345@cluster0.dsg1kir.mongodb.net/?appName=Cluster0"
}
}
29 changes: 22 additions & 7 deletions CommBank.Tests/GoalControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,29 @@ public async void Get()
Assert.Equal(goals[0], result.Value);
Assert.NotEqual(goals[1], result.Value);
}
[Fact]
public async void GetForUser()
{
// Arrange
var goals = collections.GetGoals();
var users = collections.GetUsers();

[Fact]
public async void GetForUser()
IGoalsService goalsService = new FakeGoalsService(goals, goals[0]);
IUsersService usersService = new FakeUsersService(users, users[0]);

GoalController controller = new(goalsService, usersService);

var httpContext = new Microsoft.AspNetCore.Http.DefaultHttpContext();
controller.ControllerContext.HttpContext = httpContext;

// Act
var result = await controller.GetForUser(users[0].Id!);

// Assert
Assert.NotNull(result);

foreach (var goal in result)
{
// Arrange

// Act

// Assert
Assert.Equal(users[0].Id, goal.UserId);
}
}