예제 #1
0
 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);
 }
예제 #2
0
        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
        }