Пример #1
0
        public async Task SendConfirmationEmail_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.GenerateEmailConfirmation(_testUser.Id);

            Assert.True(avatar.Succeeded);
        }
Пример #2
0
        public async Task ReportError_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.GenerateEmailConfirmation(Guid.NewGuid().ToString());

            Assert.False(avatar.Succeeded);
            Assert.Equal("Specified user does not exist!", avatar.Error.Description);
        }
Пример #3
0
        public async Task ReportError_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.GenerateEmailConfirmation(null);

            Assert.False(avatar.Succeeded);
            Assert.Equal("You must provide a user id to generate confirm email!", avatar.Error.Description);
        }