diff --git a/CommBank-Server/Properties/launchSettings.json b/CommBank-Server/Properties/launchSettings.json index 2c9f444..c508600 100644 --- a/CommBank-Server/Properties/launchSettings.json +++ b/CommBank-Server/Properties/launchSettings.json @@ -13,8 +13,9 @@ "commandName": "Project", "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:11366;http://localhost:5203", + "applicationUrl": "https://localhost:7137;http://localhost:5203", "environmentVariables": { + "ASPNETCORE_HTTPS_PORT": "7137", "ASPNETCORE_ENVIRONMENT": "Development" } }, diff --git a/CommBank-Server/Secrets.json b/CommBank-Server/Secrets.json index 0e5bf94..81ada01 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "{CONNECTION_STRING}" + "CommBank": "mongodb+srv://bocha:@bochaberi.ej9iztf.mongodb.net/?appName=bochaberi" } } \ No newline at end of file diff --git a/CommBank.Tests/GoalControllerTests.cs b/CommBank.Tests/GoalControllerTests.cs index 8380181..06ab15d 100644 --- a/CommBank.Tests/GoalControllerTests.cs +++ b/CommBank.Tests/GoalControllerTests.cs @@ -66,9 +66,22 @@ 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(users[0].Id!); + // Assert + foreach (Goal goal in result) + { + Assert.IsAssignableFrom(goal); + Assert.Equal(users[0].Id, goal.UserId); + } } -} \ No newline at end of file +}