public async Task ConfirmEmail_WhenValidUserIdRecieved() { var config = new Mock <IConfiguration>(); var email = new Mock <IEmailSender>(); var usrmgr = MockUserManager(); var am = new UserEmailManager(config.Object, new NullLogger <UserEmailManager>(), email.Object, usrmgr.Object); var avatar = await am.ConfirmEmailAddress(_testUser.Id, "9999"); Assert.True(avatar.Succeeded); }
public async Task ReportConfirmError_WhenNullUserIdRecieved() { var config = new Mock <IConfiguration>(); var email = new Mock <IEmailSender>(); var usrmgr = MockUserManager(); var am = new UserEmailManager(config.Object, new NullLogger <UserEmailManager>(), email.Object, usrmgr.Object); var avatar = await am.ConfirmEmailAddress(null, "9999"); Assert.False(avatar.Succeeded); Assert.Equal("You must provide a user id to confirm email!", avatar.Errors.First().Description); }
public async Task ReportConfirmError_WhenInvalidCodeRecieved() { var config = new Mock <IConfiguration>(); var email = new Mock <IEmailSender>(); var usrmgr = MockUserManager(); var am = new UserEmailManager(config.Object, new NullLogger <UserEmailManager>(), email.Object, usrmgr.Object); var avatar = await am.ConfirmEmailAddress(_testUserFail.Id, "1234"); Assert.False(avatar.Succeeded); Assert.Equal("Fail", avatar.Errors.First().Description); }
public async Task ReportConfirmError_WhenNotExistsUserIdRecieved() { var config = new Mock <IConfiguration>(); var email = new Mock <IEmailSender>(); var usrmgr = MockUserManager(); var am = new UserEmailManager(config.Object, new NullLogger <UserEmailManager>(), email.Object, usrmgr.Object); var avatar = await am.ConfirmEmailAddress(Guid.NewGuid().ToString(), "9999"); Assert.False(avatar.Succeeded); Assert.Equal("Specified user does not exist!", avatar.Errors.First().Description); }