public async Task ReportConfirmError_WhenNotExistsUserIdRecieved()
        {
            var config = new Mock <IConfiguration>();
            var sms    = new Mock <ISMSVerification>();
            var usrmgr = MockUserManager();
            var am     = new UserPhoneManager(config.Object, new NullLogger <UserPhoneManager>(), sms.Object, usrmgr.Object);
            var avatar = await am.ConfirmPhoneNumber("4321", "9999");

            Assert.False(avatar.Succeeded);
            Assert.Equal("Specified user does not exist!", avatar.Errors.First().Description);
        }
        public async Task ReportConfirmError_WhenNullUserIdRecieved()
        {
            var config = new Mock <IConfiguration>();
            var sms    = new Mock <ISMSVerification>();
            var usrmgr = MockUserManager();
            var am     = new UserPhoneManager(config.Object, new NullLogger <UserPhoneManager>(), sms.Object, usrmgr.Object);
            var avatar = await am.ConfirmPhoneNumber(null, "9999");

            Assert.False(avatar.Succeeded);
            Assert.Equal("You must provide a user id & verification token to confirm sms verification code!", avatar.Errors.First().Description);
        }
        public async Task ConfirmPhone_WhenValidUserIdRecieved()
        {
            var config = new Mock <IConfiguration>();
            var sms    = new Mock <ISMSVerification>();

            sms.Setup(x => x.VerifyPhoneNumber(_testUser.PhoneNumber, "9999")).ReturnsAsync(true);

            var usrmgr = MockUserManager();
            var am     = new UserPhoneManager(config.Object, new NullLogger <UserPhoneManager>(), sms.Object, usrmgr.Object);
            var avatar = await am.ConfirmPhoneNumber(_testUser.Id, "9999");

            Assert.True(avatar.Succeeded);
        }
        public async Task ReportConfirmError_WhenInvalidCodeRecieved()
        {
            var config = new Mock <IConfiguration>();
            var sms    = new Mock <ISMSVerification>();

            sms.Setup(x => x.VerifyPhoneNumber(_testUser.PhoneNumber, "1234")).ReturnsAsync(false);

            var usrmgr = MockUserManager();
            var am     = new UserPhoneManager(config.Object, new NullLogger <UserPhoneManager>(), sms.Object, usrmgr.Object);
            var avatar = await am.ConfirmPhoneNumber(_testUser.Id, "1234");

            Assert.False(avatar.Succeeded);
            Assert.Equal("Verification code could not be validated!", avatar.Errors.First().Description);
        }