From 540bbb4b87e932a9eb88278c0ce2e68322742e93 Mon Sep 17 00:00:00 2001 From: Ekansh Satsangi Date: Thu, 12 Mar 2026 12:29:02 +0530 Subject: [PATCH] Support icons --- CommBank-Server/Models/Goal.cs | 2 ++ CommBank-Server/Secrets.json | 2 +- CommBank-Server/appsettings.Development.json | 3 +-- CommBank.Tests/GoalControllerTests.cs | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CommBank-Server/Models/Goal.cs b/CommBank-Server/Models/Goal.cs index 77ff1ad..81f0192 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 0e5bf94..8d17ba6 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "{CONNECTION_STRING}" + "CommBank": "mongodb+srv://Ekansh:qwertyuiop12345@cluster0.l3imvdb.mongodb.net/commbank?retryWrites=true&w=majority" } } \ No newline at end of file diff --git a/CommBank-Server/appsettings.Development.json b/CommBank-Server/appsettings.Development.json index ce16a2e..cd7d0bc 100644 --- a/CommBank-Server/appsettings.Development.json +++ b/CommBank-Server/appsettings.Development.json @@ -5,5 +5,4 @@ "Microsoft.AspNetCore": "Warning" } } -} - +} \ No newline at end of file diff --git a/CommBank.Tests/GoalControllerTests.cs b/CommBank.Tests/GoalControllerTests.cs index 8380181..473e709 100644 --- a/CommBank.Tests/GoalControllerTests.cs +++ b/CommBank.Tests/GoalControllerTests.cs @@ -66,9 +66,26 @@ 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); + + var index = 0; + foreach (Goal goal in result!) + { + Assert.IsAssignableFrom(goal); + Assert.Equal(goals[0].UserId, goal.UserId); + index++; + } } } \ No newline at end of file