diff --git a/CommBank-Server/CommBank.csproj b/CommBank-Server/CommBank.csproj
index 983cc88..9d96c49 100644
--- a/CommBank-Server/CommBank.csproj
+++ b/CommBank-Server/CommBank.csproj
@@ -6,6 +6,7 @@
enable
CommBank_Server
CommBank-Server
+ 1b71bddd-026e-4453-be5f-2a6c98a64c48
diff --git a/CommBank-Server/Models/Goal.cs b/CommBank-Server/Models/Goal.cs
index 77ff1ad..7ede300 100644
--- a/CommBank-Server/Models/Goal.cs
+++ b/CommBank-Server/Models/Goal.cs
@@ -12,7 +12,7 @@ public class Goal
public string? Name { get; set; }
public UInt64 TargetAmount { get; set; } = 0;
-
+ public string? Icon { get; set; }
public DateTime TargetDate { get; set; }
public double Balance { get; set; } = 0.00;
diff --git a/CommBank-Server/Secrets.json b/CommBank-Server/Secrets.json
index 0e5bf94..b25187d 100644
--- a/CommBank-Server/Secrets.json
+++ b/CommBank-Server/Secrets.json
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
- "CommBank": "{CONNECTION_STRING}"
+ "CommBank": "mongodb+srv://commbankuser:AORn0HcW92w6bO72@servercluster.bwzd6ay.mongodb.net/?appName=ServerCluster"
}
}
\ No newline at end of file
diff --git a/CommBank.Tests/CommBank.Tests.csproj b/CommBank.Tests/CommBank.Tests.csproj
index 4d9413f..3dec2de 100644
--- a/CommBank.Tests/CommBank.Tests.csproj
+++ b/CommBank.Tests/CommBank.Tests.csproj
@@ -10,6 +10,7 @@
+
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/CommBank.Tests/GoalControllerTests.cs b/CommBank.Tests/GoalControllerTests.cs
index 8380181..c0d3606 100644
--- a/CommBank.Tests/GoalControllerTests.cs
+++ b/CommBank.Tests/GoalControllerTests.cs
@@ -66,9 +66,31 @@ public async void Get()
public async void GetForUser()
{
// Arrange
-
+ var goals = collections.GetGoals();
+ var users = collections.GetUsers();
+
+ // important: set icon so we can test it
+ goals[0].Icon = "🏠";
+
+ 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 returnedGoals = Assert.IsAssignableFrom>(result);
+
+ var firstGoal = returnedGoals.First();
+
+ Assert.Equal(goals[0].Id, firstGoal.Id);
+ Assert.Equal(goals[0].Name, firstGoal.Name);
+
+
}
}
\ No newline at end of file