Skip to content

Commit

Permalink
Added set password tests
Browse files Browse the repository at this point in the history
  • Loading branch information
David Walker committed Mar 16, 2020
1 parent 86f887b commit 9c870e8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/DroneFlightLog.Data.Tests/UserManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class UserManagerTests
private const string UserName = "Some User";
private const string AsyncUserName = "Some Other User";
private const string Password = "password";
private const string UpdatedPassword = "newpassword";

private IDroneFlightLogFactory<DroneFlightLogDbContext> _factory;
private int _userId;
Expand Down Expand Up @@ -116,8 +117,24 @@ public async Task AuthenticateAsyncTest()
[TestMethod]
public void FailedAuthenticationTest()
{
bool authenticated = _factory.Users.Authenticate(UserName, "");
bool authenticated = _factory.Users.Authenticate(UserName, "the wrong password");
Assert.IsFalse(authenticated);
}

[TestMethod]
public void SetPassswordTest()
{
_factory.Users.SetPassword(UserName, UpdatedPassword);
bool authenticated = _factory.Users.Authenticate(UserName, UpdatedPassword);
Assert.IsTrue(authenticated);
}

[TestMethod]
public async Task SetPassswordAsyncTest()
{
await _factory.Users.SetPasswordAsync(UserName, UpdatedPassword);
bool authenticated = await _factory.Users.AuthenticateAsync(UserName, UpdatedPassword);
Assert.IsTrue(authenticated);
}
}
}

0 comments on commit 9c870e8

Please sign in to comment.