From 1b36053ccd932d14b96342aed3892a3bc8b01655 Mon Sep 17 00:00:00 2001 From: Harini Date: Wed, 10 Jun 2026 23:03:18 +0530 Subject: [PATCH 1/2] task 1 completed -backend working --- CommBank-Server/Secrets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommBank-Server/Secrets.json b/CommBank-Server/Secrets.json index 0e5bf949..e372e03a 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "{CONNECTION_STRING}" + "CommBank": "mongodb+srv://adminUser:Test12345@cluster0.dsg1kir.mongodb.net/?appName=Cluster0" } } \ No newline at end of file From b4aa8779cc075281b08e04e7f2c12ee0a27b1659 Mon Sep 17 00:00:00 2001 From: Harini Date: Thu, 11 Jun 2026 00:17:21 +0530 Subject: [PATCH 2/2] completed task 4 tests --- CommBank.Tests/GoalControllerTests.cs | 29 ++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/CommBank.Tests/GoalControllerTests.cs b/CommBank.Tests/GoalControllerTests.cs index 8380181f..e1f34741 100644 --- a/CommBank.Tests/GoalControllerTests.cs +++ b/CommBank.Tests/GoalControllerTests.cs @@ -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); } } \ No newline at end of file