public async void Create()
        {
            var mock  = new ServiceMockFacade <IPostHistoryRepository>();
            var model = new ApiPostHistoryRequestModel();

            mock.RepositoryMock.Setup(x => x.Create(It.IsAny <PostHistory>())).Returns(Task.FromResult(new PostHistory()));
            var service = new PostHistoryService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.PostHistoryModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLPostHistoryMapperMock,
                                                 mock.DALMapperMockFactory.DALPostHistoryMapperMock);

            CreateResponse <ApiPostHistoryResponseModel> response = await service.Create(model);

            response.Should().NotBeNull();
            mock.ModelValidatorMockFactory.PostHistoryModelValidatorMock.Verify(x => x.ValidateCreateAsync(It.IsAny <ApiPostHistoryRequestModel>()));
            mock.RepositoryMock.Verify(x => x.Create(It.IsAny <PostHistory>()));
        }
        public async void Create_NoErrorsOccurred_ShouldReturnResponse()
        {
            var mock = new ServiceMockFacade <IPostHistoryService, IPostHistoryRepository>();

            var model = new ApiPostHistoryServerRequestModel();

            mock.RepositoryMock.Setup(x => x.Create(It.IsAny <PostHistory>())).Returns(Task.FromResult(new PostHistory()));
            var service = new PostHistoryService(mock.LoggerMock.Object,
                                                 mock.MediatorMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.PostHistoryModelValidatorMock.Object,
                                                 mock.DALMapperMockFactory.DALPostHistoryMapperMock);

            CreateResponse <ApiPostHistoryServerResponseModel> response = await service.Create(model);

            response.Should().NotBeNull();
            response.Success.Should().BeTrue();
            mock.ModelValidatorMockFactory.PostHistoryModelValidatorMock.Verify(x => x.ValidateCreateAsync(It.IsAny <ApiPostHistoryServerRequestModel>()));
            mock.RepositoryMock.Verify(x => x.Create(It.IsAny <PostHistory>()));
            mock.MediatorMock.Verify(x => x.Publish(It.IsAny <PostHistoryCreatedNotification>(), It.IsAny <CancellationToken>()));
        }
        public async void Create_ErrorsOccurred_ShouldReturnErrorResponse()
        {
            var mock          = new ServiceMockFacade <IPostHistoryService, IPostHistoryRepository>();
            var model         = new ApiPostHistoryServerRequestModel();
            var validatorMock = new Mock <IApiPostHistoryServerRequestModelValidator>();

            validatorMock.Setup(x => x.ValidateCreateAsync(It.IsAny <ApiPostHistoryServerRequestModel>())).Returns(Task.FromResult(new FluentValidation.Results.ValidationResult(new List <ValidationFailure>()
            {
                new ValidationFailure("text", "test")
            })));
            var service = new PostHistoryService(mock.LoggerMock.Object,
                                                 mock.MediatorMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 validatorMock.Object,
                                                 mock.DALMapperMockFactory.DALPostHistoryMapperMock);

            CreateResponse <ApiPostHistoryServerResponseModel> response = await service.Create(model);

            response.Should().NotBeNull();
            response.Success.Should().BeFalse();
            validatorMock.Verify(x => x.ValidateCreateAsync(It.IsAny <ApiPostHistoryServerRequestModel>()));
            mock.MediatorMock.Verify(x => x.Publish(It.IsAny <PostHistoryCreatedNotification>(), It.IsAny <CancellationToken>()), Times.Never());
        }