Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Icons #45

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CommBank-Server/Models/Goal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -27,4 +29,4 @@ public class Goal

[BsonRepresentation(BsonType.ObjectId)]
public string? UserId { get; set; }
}
}
4 changes: 2 additions & 2 deletions CommBank-Server/Secrets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
"CommBank": "{CONNECTION_STRING}"
"CommBank": "mongodb+srv://benfragiacomo2:[email protected]/?retryWrites=true&w=majority&appName=Cluster0"
}
}
}
17 changes: 16 additions & 1 deletion CommBank.Tests/GoalControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(goals[0].UserId!);

// Assert
Assert.NotNull(result);
var safeResult = Assert.IsType<List<Goal>>(result);

foreach (Goal goal in safeResult)
{
Assert.Equal(goals[0].UserId, goal.UserId);
}
}
}
}