public async Task Handle_NormalValues_RegisterExternalUser() { // arrange var cancellationToken = new CancellationToken(); var unitOfWorkFactory = new TransactionScopeUnitOfWorkFactory(); var dbContextFactory = new DefaultDbContextFactory(); var identityServiceFactory = new IdentityServiceFactory(); var classifierRepositoryFactoryBuilder = new ClassifierRepositoryFactoryBuilder(dbContextFactory) { UserTypeCode = ClassifierTypeCode.User }; var classifierRepositoryFactory = classifierRepositoryFactoryBuilder.Build(); // todo: test EmailConfirmationService var emailConfirmationServiceMock = new Mock <IEmailConfirmationService>(); var handler = new ExternalRegisterHandler(new NullLogger <ExternalRegisterHandler>(), classifierRepositoryFactory, identityServiceFactory.UserManager, identityServiceFactory.SignInManager, emailConfirmationServiceMock.Object); using (var _ = unitOfWorkFactory.Create()) { // act var command = new ExternalRegister { Email = "*****@*****.**" }; var result = await handler.Handle(command, cancellationToken); // assert Assert.IsTrue(result.Success, string.Join(",", result.Message)); } }
public async Task <ApiResult> ExternalRegister(ExternalRegister request) { return(await _mediator.Send(request)); }