Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }