From 0c76a284d5f60559a4ed01a927350a07fd8c6286 Mon Sep 17 00:00:00 2001 From: Priyanka Date: Mon, 1 Jun 2026 12:27:35 +0530 Subject: [PATCH 1/2] Added optional Icon field to Goal model --- CommBank-Server/Models/Goal.cs | 2 ++ CommBank-Server/Secrets.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CommBank-Server/Models/Goal.cs b/CommBank-Server/Models/Goal.cs index 77ff1ad5..81f01923 100644 --- a/CommBank-Server/Models/Goal.cs +++ b/CommBank-Server/Models/Goal.cs @@ -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; } diff --git a/CommBank-Server/Secrets.json b/CommBank-Server/Secrets.json index 0e5bf949..208fa9d5 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "{CONNECTION_STRING}" + "CommBank": "mongodb+srv://priyankasc29_db_user:LJYwJD91wHaUStf0@cluster0.jaztx7q.mongodb.net/?appName=Cluster0" } } \ No newline at end of file From 3f098cc28db46dc40a9ee65f6349456235790abf Mon Sep 17 00:00:00 2001 From: Priyanka Date: Fri, 12 Jun 2026 15:41:32 +0530 Subject: [PATCH 2/2] add goal iconand functionality and unit tests --- CommBank-Web | 1 + CommBank.Tests/GoalControllerTests.cs | 30 ++++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) create mode 160000 CommBank-Web diff --git a/CommBank-Web b/CommBank-Web new file mode 160000 index 00000000..73f96cf7 --- /dev/null +++ b/CommBank-Web @@ -0,0 +1 @@ +Subproject commit 73f96cf7b0643bed424ba8dcd837ae1e26d4dfcc diff --git a/CommBank.Tests/GoalControllerTests.cs b/CommBank.Tests/GoalControllerTests.cs index 8380181f..6b95d0e0 100644 --- a/CommBank.Tests/GoalControllerTests.cs +++ b/CommBank.Tests/GoalControllerTests.cs @@ -62,13 +62,29 @@ public async void Get() Assert.NotEqual(goals[1], result.Value); } - [Fact] - public async void GetForUser() + [Fact] +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 + var index = 0; + foreach (Goal goal in result!) { - // Arrange - - // Act - - // Assert + Assert.IsAssignableFrom(goal); + Assert.Equal(goals[index].Id, goal.Id); + Assert.Equal(goals[index].Name, goal.Name); + index++; } +} } \ No newline at end of file