public static void Initialize() { InitializeBus(); ExceptionHandlerMock = new Mock <IExceptionHandler>(); Handler = new Handler(ExceptionHandlerMock.Object); PasswordServiceMock = new Mock <IPasswordService>(); OneTimeOperationServiceMock = new Mock <IOneTimeSecuredOperationService>(); ResetPasswordHandler = new ResetPasswordHandler(Handler, BusClientMock.Object, PasswordServiceMock.Object, OneTimeOperationServiceMock.Object); var email = "*****@*****.**"; Command = new ResetPassword { Request = new Request { Id = Guid.NewGuid(), CreatedAt = DateTime.Now, Culture = "en-US", Name = "name", Origin = "collectively", Resource = "resource" }, Email = email, Endpoint = "endpoint" }; Token = "token"; var oneTimeOperation = new OneTimeSecuredOperation(Guid.Empty, "type", email, Token, DateTime.MaxValue); OneTimeOperationServiceMock.Setup(x => x.GetAsync(Moq.It.IsAny <Guid>())) .ReturnsAsync(oneTimeOperation); }
public void SetUp() { var dbContextOptions = new DbContextOptionsBuilder <LoginContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; LoginContext = new LoginContext(dbContextOptions); RequestId = Guid.NewGuid(); ClientId = Guid.NewGuid(); UserService = Substitute.For <IWebUserService>(); EmailService = Substitute.For <IEmailService>(); Handler = new ResetPasswordHandler(UserService, LoginContext, EmailService); }