diff --git a/.gitignore b/.gitignore index 67697151..9721ce3e 100644 --- a/.gitignore +++ b/.gitignore @@ -200,6 +200,11 @@ _TeamCity* # DotCover is a Code Coverage Tool *.dotCover +# Local secret and configuration files +Secrets.json +appsettings*.json +*.dotCover + # AxoCover is a Code Coverage Tool .axoCover/* !.axoCover/settings.json diff --git a/CommBank-Server/CommBank.zip b/CommBank-Server/CommBank.zip new file mode 100644 index 00000000..04bf2993 Binary files /dev/null and b/CommBank-Server/CommBank.zip differ diff --git a/CommBank-Server/Models/Goal.cs b/CommBank-Server/Models/Goal.cs index 77ff1ad5..0698000e 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..940d1a7c 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "{CONNECTION_STRING}" + "CommBank": "Response:Server=localhost;Database=CommBank;User Id=your_username;Password=your_password;" } } \ No newline at end of file diff --git a/CommBank.Tests/GoalControllerTests.cs b/CommBank.Tests/GoalControllerTests.cs index 8380181f..94e452e3 100644 --- a/CommBank.Tests/GoalControllerTests.cs +++ b/CommBank.Tests/GoalControllerTests.cs @@ -62,13 +62,32 @@ public async void Get() Assert.NotEqual(goals[1], result.Value); } + [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(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 diff --git a/commbank-web b/commbank-web new file mode 160000 index 00000000..65fb012d --- /dev/null +++ b/commbank-web @@ -0,0 +1 @@ +Subproject commit 65fb012df3eab4be6fcb708ecafbbe5cc2ba3972