Exemplo n.º 1
0
        private void SetupDependencies(IQueryable <UserListingServiceModel> users)
        {
            var roles = new IdentityRole[]
            {
                new IdentityRole(WebConstants.AdministratorRole),
            };

            this.userService
            .Setup(s => s.GetAll())
            .Returns(users);

            this.roleManager
            .Setup(rm => rm.Roles)
            .Returns(roles.AsQueryable());

            this.userManager
            .Setup(um => um.FindByEmailAsync(It.IsAny <string>()))
            .ReturnsAsync(new User());

            this.userManager
            .Setup(um => um.GetRolesAsync(It.IsAny <User>()))
            .ReturnsAsync(new List <string> {
                WebConstants.AdministratorRole
            });
        }