public void CreateMethod() { // preparation var notification = new Mock.NotificationServiceMock(); var validation = new Mock.ValidationUserServiceMock(); var logger = new Mock.LoggerMock <UserApi>(); var userApi = new UserApi(notification, validation, logger); }
public async Task RunAsyncMethod(bool isValid, string userUuid) { // preparation var notification = new Mock.NotificationServiceMock(); var validation = new Mock <IValidationUserService>(); var validationResult = new IValidationUserService.ValidateResult() { IsValid = isValid }; validation.Setup(_ => _.ValidateAsync(It.IsAny <HttpRequest>(), It.IsAny <IUser>())).ReturnsAsync(validationResult); var logger = new Mock.LoggerMock <UserApi>(); var userApi = new UserApi(notification, validation.Object, logger); var context = new Mock.HttpContextMock(); // action await userApi.RunAsync(context.Request, userUuid); // assert }