public void given_a_request_when_ProcessImageUseCase_ExecuteGet_method_is_called_then_it_returns_the_response_object_of_correct_type_and_data()
        {
            //assert
            var request  = MatProcessDataHelper.CreateGetProcessImageRequestObject();
            var imageKey = ImagePersistingHelper.generateImageKey(request.processType, request.imageId, request.processRef, request.fileExtension);

            var expectedBase64ImageString = MatProcessDataHelper.CreatePostProcessImageRequestObject().base64Image;

            _mockGateway.Setup(g => g.RetrieveImage(It.Is <string>(obj => obj == imageKey))).Returns(expectedBase64ImageString);

            var expectedUsecaseResponse = new GetProcessImageResponse(expectedBase64ImageString, DateTime.Now, request); //The date time is impossible to test equality for, as it will differ in few microseconds from the actual response one. So I set it to DateTime.Min to signify its unimportance.

            //act
            var usecaseResponse = _processImageUseCase.ExecuteGet(request);

            //assert
            Assert.IsNotNull(usecaseResponse);
            Assert.IsInstanceOf <GetProcessImageResponse>(usecaseResponse);

            Assert.AreEqual(expectedUsecaseResponse.Base64Image, usecaseResponse.Base64Image);
            Assert.AreEqual(expectedUsecaseResponse.Request.processRef, usecaseResponse.Request.processRef);
            Assert.AreEqual(expectedUsecaseResponse.Request.imageId, usecaseResponse.Request.imageId);

            //This assertion has an accuracy of 1 second. If time difference between [when expected object was created] and [when actual usecase response was created] is within 1 second, then the times are considered equal. 1 Second is plenty of time for the code in between to run, considering it's using a Mock gateway.
            Assert.Less((usecaseResponse.GeneratedAt - expectedUsecaseResponse.GeneratedAt).TotalMilliseconds, 1000);
        }
        public void given_successful_request_validation_when_GetProcessImage_controller_method_is_called_then_it_returns_an_Ok_result_with_correct_data_based_of_that_request()
        {
            //arrange
            var request          = MatProcessDataHelper.CreateGetProcessImageRequestObject();
            var expectedResponse = new GetProcessImageResponse(_faker.Random.Hash().ToString(), DateTime.Now, request);

            _mockUsecase.Setup(u => u.ExecuteGet(It.IsAny <GetProcessImageRequest>())).Returns(expectedResponse);
            _mockGetValidator.Setup(x => x.Validate(It.IsAny <GetProcessImageRequest>())).Returns(new FV.ValidationResult()); //setup validator to return a no error validation result

            //act
            var controllerResponse = _processImageController.GetProcessImage(request);
            var result             = controllerResponse as ObjectResult;
            var resultContents     = result.Value as GetProcessImageResponse;

            //assert
            Assert.NotNull(controllerResponse);
            Assert.IsInstanceOf <OkObjectResult>(result);
            Assert.NotNull(result);
            Assert.IsInstanceOf <GetProcessImageResponse>(resultContents);
            Assert.NotNull(resultContents);

            Assert.AreEqual(expectedResponse.Base64Image, resultContents.Base64Image);
            Assert.AreEqual(expectedResponse.GeneratedAt, resultContents.GeneratedAt);
            Assert.AreEqual(expectedResponse.Request.processRef, resultContents.Request.processRef);
            Assert.AreEqual(expectedResponse.Request.imageId, resultContents.Request.imageId);
        }