diff --git a/Code.code-workspace b/Code.code-workspace new file mode 100644 index 00000000..698352e1 --- /dev/null +++ b/Code.code-workspace @@ -0,0 +1,18 @@ +{ + "folders": [ + { + "path": "../../.." + }, + { + "name": "CommBank-Server-", + "path": "." + } + ], + "settings": { + "files.associations": { + "LE61.C": "cpp", + "LE7_1.C": "cpp", + "stdlib.h": "c" + } + } +} \ No newline at end of file diff --git a/CommBank-Server/Models/Goal.cs b/CommBank-Server/Models/Goal.cs index 77ff1ad5..744fa9b7 100644 --- a/CommBank-Server/Models/Goal.cs +++ b/CommBank-Server/Models/Goal.cs @@ -11,6 +11,9 @@ 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..aa161a63 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "{CONNECTION_STRING}" + "CommBank": "mongodb+srv://aviksingharoy:Avik%402006@sampcluster1.eegvrec.mongodb.net/?appName=SampCluster1" } } \ No newline at end of file diff --git a/CommBank.Tests/GoalControllerTests.cs b/CommBank.Tests/GoalControllerTests.cs index 8380181f..a5bc9b14 100644 --- a/CommBank.Tests/GoalControllerTests.cs +++ b/CommBank.Tests/GoalControllerTests.cs @@ -66,9 +66,24 @@ 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 + Assert.NotNull(result); + Assert.Equal(goals.Count, result!.Count()); + + foreach (Goal goal in result) + { + Assert.IsAssignableFrom(goal); + } } } \ No newline at end of file