コード例 #1
0
        public async Task TestAddRoleAndTokenAsync()
        {
            //Arrange
            var(mockSignInManager, mockUserManager, mockEmailConfirmation, mockEmailContentService, AuthService) = CreateAuthService();
            mockUserManager
            .Setup(s => s.FindByEmailAsync(It.IsAny <string>()))
            .ReturnsAsync(GetTestUserWithAllFields());

            mockUserManager
            .Setup(s => s.GenerateEmailConfirmationTokenAsync(It.IsAny <User>()))
            .ReturnsAsync(GetTestCodeForResetPasswordAndConfirmEmail());
            var registerDTO = GetTestRegisterDto();
            //Act
            string token = await AuthService.AddRoleAndTokenAsync(registerDTO.Email);

            //Assert
            Assert.NotNull(token);
            Assert.IsType <string>(token);
        }