JavaScript
- 3 ответа
- 0 вопросов
2
Вклад в тег
//Arrange
var _userRepository = new Mock<IUserRepository>();
var _userStore = new Mock<IUserStore<ApplicationUser>>();
var userManager = new UserManager<ApplicationUser>(_userStore.Object);
var applicationUserManager = new ApplicationUserManager(_userStore.Object);
var _countersIdRepository = new Mock<ICountersIdRepository>();
var _userService = new Mock<IUserService>();
RegisterBindingModel registerModel = new RegisterBindingModel() { Email = "test@gmail.com", Password = "qweasd" };
ApplicationUser appUser = new ApplicationUser() { FirstName = "TestName", LastName = "TestLastName" };
UserService userService = new UserService(_userRepository.Object, _countersIdRepository.Object);
_userStore.Setup(x => x.CreateAsync(appUser)).Returns(Task.FromResult(IdentityResult.Success));
_countersIdRepository.Setup(x => x.GetUserLastId()).Returns(10);
_userService.Setup(x => x.Register(registerModel)).Returns(Task.FromResult(IdentityResult.Success));
userService.UserManager = applicationUserManager;