public async void Delete()
        {
            var mock  = new ServiceMockFacade <IProductDescriptionRepository>();
            var model = new ApiProductDescriptionRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new ProductDescriptionService(mock.LoggerMock.Object,
                                                        mock.RepositoryMock.Object,
                                                        mock.ModelValidatorMockFactory.ProductDescriptionModelValidatorMock.Object,
                                                        mock.BOLMapperMockFactory.BOLProductDescriptionMapperMock,
                                                        mock.DALMapperMockFactory.DALProductDescriptionMapperMock,
                                                        mock.BOLMapperMockFactory.BOLProductModelProductDescriptionCultureMapperMock,
                                                        mock.DALMapperMockFactory.DALProductModelProductDescriptionCultureMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.ProductDescriptionModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }
Ejemplo n.º 2
0
        public async void Delete_NoErrorsOccurred_ShouldReturnResponse()
        {
            var mock  = new ServiceMockFacade <ISaleTicketsService, ISaleTicketsRepository>();
            var model = new ApiSaleTicketsServerRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new SaleTicketsService(mock.LoggerMock.Object,
                                                 mock.MediatorMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.SaleTicketsModelValidatorMock.Object,
                                                 mock.DALMapperMockFactory.DALSaleTicketsMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            response.Success.Should().BeTrue();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.SaleTicketsModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
            mock.MediatorMock.Verify(x => x.Publish(It.IsAny <SaleTicketsDeletedNotification>(), It.IsAny <CancellationToken>()));
        }
Ejemplo n.º 3
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <ICustomerRepository>();
            var model = new ApiCustomerRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new CustomerService(mock.LoggerMock.Object,
                                              mock.RepositoryMock.Object,
                                              mock.ModelValidatorMockFactory.CustomerModelValidatorMock.Object,
                                              mock.BOLMapperMockFactory.BOLCustomerMapperMock,
                                              mock.DALMapperMockFactory.DALCustomerMapperMock,
                                              mock.BOLMapperMockFactory.BOLSalesOrderHeaderMapperMock,
                                              mock.DALMapperMockFactory.DALSalesOrderHeaderMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.CustomerModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }
Ejemplo n.º 4
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <ITeacherSkillRepository>();
            var model = new ApiTeacherSkillRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new TeacherSkillService(mock.LoggerMock.Object,
                                                  mock.RepositoryMock.Object,
                                                  mock.ModelValidatorMockFactory.TeacherSkillModelValidatorMock.Object,
                                                  mock.BOLMapperMockFactory.BOLTeacherSkillMapperMock,
                                                  mock.DALMapperMockFactory.DALTeacherSkillMapperMock,
                                                  mock.BOLMapperMockFactory.BOLRateMapperMock,
                                                  mock.DALMapperMockFactory.DALRateMapperMock,
                                                  mock.BOLMapperMockFactory.BOLTeacherXTeacherSkillMapperMock,
                                                  mock.DALMapperMockFactory.DALTeacherXTeacherSkillMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.TeacherSkillModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }
Ejemplo n.º 5
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <IUnitMeasureRepository>();
            var model = new ApiUnitMeasureRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <string>())).Returns(Task.CompletedTask);
            var service = new UnitMeasureService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.UnitMeasureModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLUnitMeasureMapperMock,
                                                 mock.DALMapperMockFactory.DALUnitMeasureMapperMock,
                                                 mock.BOLMapperMockFactory.BOLBillOfMaterialMapperMock,
                                                 mock.DALMapperMockFactory.DALBillOfMaterialMapperMock,
                                                 mock.BOLMapperMockFactory.BOLProductMapperMock,
                                                 mock.DALMapperMockFactory.DALProductMapperMock);

            ActionResponse response = await service.Delete(default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <string>()));
            mock.ModelValidatorMockFactory.UnitMeasureModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <string>()));
        }
Ejemplo n.º 6
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <ICurrencyRepository>();
            var model = new ApiCurrencyRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <string>())).Returns(Task.CompletedTask);
            var service = new CurrencyService(mock.LoggerMock.Object,
                                              mock.RepositoryMock.Object,
                                              mock.ModelValidatorMockFactory.CurrencyModelValidatorMock.Object,
                                              mock.BOLMapperMockFactory.BOLCurrencyMapperMock,
                                              mock.DALMapperMockFactory.DALCurrencyMapperMock,
                                              mock.BOLMapperMockFactory.BOLCountryRegionCurrencyMapperMock,
                                              mock.DALMapperMockFactory.DALCountryRegionCurrencyMapperMock,
                                              mock.BOLMapperMockFactory.BOLCurrencyRateMapperMock,
                                              mock.DALMapperMockFactory.DALCurrencyRateMapperMock);

            ActionResponse response = await service.Delete(default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <string>()));
            mock.ModelValidatorMockFactory.CurrencyModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <string>()));
        }
Ejemplo n.º 7
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <ILocationRepository>();
            var model = new ApiLocationRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <short>())).Returns(Task.CompletedTask);
            var service = new LocationService(mock.LoggerMock.Object,
                                              mock.RepositoryMock.Object,
                                              mock.ModelValidatorMockFactory.LocationModelValidatorMock.Object,
                                              mock.BOLMapperMockFactory.BOLLocationMapperMock,
                                              mock.DALMapperMockFactory.DALLocationMapperMock,
                                              mock.BOLMapperMockFactory.BOLProductInventoryMapperMock,
                                              mock.DALMapperMockFactory.DALProductInventoryMapperMock,
                                              mock.BOLMapperMockFactory.BOLWorkOrderRoutingMapperMock,
                                              mock.DALMapperMockFactory.DALWorkOrderRoutingMapperMock);

            ActionResponse response = await service.Delete(default(short));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <short>()));
            mock.ModelValidatorMockFactory.LocationModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <short>()));
        }
Ejemplo n.º 8
0
        public async void Delete_ErrorsOccurred_ShouldReturnErrorResponse()
        {
            var mock          = new ServiceMockFacade <ISelfReferenceService, ISelfReferenceRepository>();
            var model         = new ApiSelfReferenceServerRequestModel();
            var validatorMock = new Mock <IApiSelfReferenceServerRequestModelValidator>();

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

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            response.Success.Should().BeFalse();
            validatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
            mock.MediatorMock.Verify(x => x.Publish(It.IsAny <SelfReferenceDeletedNotification>(), It.IsAny <CancellationToken>()), Times.Never());
        }
Ejemplo n.º 9
0
        public async void Delete_NoErrors()
        {
            var mock  = new ServiceMockFacade <IArtistRepository>();
            var model = new ApiArtistServerRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new ArtistService(mock.LoggerMock.Object,
                                            mock.MediatorMock.Object,
                                            mock.RepositoryMock.Object,
                                            mock.ModelValidatorMockFactory.ArtistModelValidatorMock.Object,
                                            mock.DALMapperMockFactory.DALArtistMapperMock,
                                            mock.DALMapperMockFactory.DALBankAccountMapperMock,
                                            mock.DALMapperMockFactory.DALEmailMapperMock,
                                            mock.DALMapperMockFactory.DALTransactionMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            response.Success.Should().BeTrue();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.ArtistModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
            mock.MediatorMock.Verify(x => x.Publish(It.IsAny <ArtistDeletedNotification>(), It.IsAny <CancellationToken>()));
        }
Ejemplo n.º 10
0
        public async void Delete_NoErrorsOccurred_ShouldReturnResponse()
        {
            var mock  = new ServiceMockFacade <IEmployeeService, IEmployeeRepository>();
            var model = new ApiEmployeeServerRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new EmployeeService(mock.LoggerMock.Object,
                                              mock.MediatorMock.Object,
                                              mock.RepositoryMock.Object,
                                              mock.ModelValidatorMockFactory.EmployeeModelValidatorMock.Object,
                                              mock.DALMapperMockFactory.DALEmployeeMapperMock,
                                              mock.DALMapperMockFactory.DALCustomerCommunicationMapperMock,
                                              mock.DALMapperMockFactory.DALPipelineStepMapperMock,
                                              mock.DALMapperMockFactory.DALPipelineStepNoteMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            response.Success.Should().BeTrue();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.EmployeeModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
            mock.MediatorMock.Verify(x => x.Publish(It.IsAny <EmployeeDeletedNotification>(), It.IsAny <CancellationToken>()));
        }
Ejemplo n.º 11
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <IEmployeeRepository>();
            var model = new ApiEmployeeRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new EmployeeService(mock.LoggerMock.Object,
                                              mock.RepositoryMock.Object,
                                              mock.ModelValidatorMockFactory.EmployeeModelValidatorMock.Object,
                                              mock.BOLMapperMockFactory.BOLEmployeeMapperMock,
                                              mock.DALMapperMockFactory.DALEmployeeMapperMock,
                                              mock.BOLMapperMockFactory.BOLClientCommunicationMapperMock,
                                              mock.DALMapperMockFactory.DALClientCommunicationMapperMock,
                                              mock.BOLMapperMockFactory.BOLPipelineStepMapperMock,
                                              mock.DALMapperMockFactory.DALPipelineStepMapperMock,
                                              mock.BOLMapperMockFactory.BOLPipelineStepNoteMapperMock,
                                              mock.DALMapperMockFactory.DALPipelineStepNoteMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.EmployeeModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }
Ejemplo n.º 12
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <IStudentRepository>();
            var model = new ApiStudentRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new StudentService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.StudentModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLStudentMapperMock,
                                             mock.DALMapperMockFactory.DALStudentMapperMock,
                                             mock.BOLMapperMockFactory.BOLLessonXStudentMapperMock,
                                             mock.DALMapperMockFactory.DALLessonXStudentMapperMock,
                                             mock.BOLMapperMockFactory.BOLLessonXTeacherMapperMock,
                                             mock.DALMapperMockFactory.DALLessonXTeacherMapperMock,
                                             mock.BOLMapperMockFactory.BOLStudentXFamilyMapperMock,
                                             mock.DALMapperMockFactory.DALStudentXFamilyMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.StudentModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }
Ejemplo n.º 13
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <IBusinessEntityRepository>();
            var model = new ApiBusinessEntityRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new BusinessEntityService(mock.LoggerMock.Object,
                                                    mock.RepositoryMock.Object,
                                                    mock.ModelValidatorMockFactory.BusinessEntityModelValidatorMock.Object,
                                                    mock.BOLMapperMockFactory.BOLBusinessEntityMapperMock,
                                                    mock.DALMapperMockFactory.DALBusinessEntityMapperMock,
                                                    mock.BOLMapperMockFactory.BOLBusinessEntityAddressMapperMock,
                                                    mock.DALMapperMockFactory.DALBusinessEntityAddressMapperMock,
                                                    mock.BOLMapperMockFactory.BOLBusinessEntityContactMapperMock,
                                                    mock.DALMapperMockFactory.DALBusinessEntityContactMapperMock,
                                                    mock.BOLMapperMockFactory.BOLPersonMapperMock,
                                                    mock.DALMapperMockFactory.DALPersonMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.BusinessEntityModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }
Ejemplo n.º 14
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <IHandlerRepository>();
            var model = new ApiHandlerRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new HandlerService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.HandlerModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLHandlerMapperMock,
                                             mock.DALMapperMockFactory.DALHandlerMapperMock,
                                             mock.BOLMapperMockFactory.BOLAirTransportMapperMock,
                                             mock.DALMapperMockFactory.DALAirTransportMapperMock,
                                             mock.BOLMapperMockFactory.BOLHandlerPipelineStepMapperMock,
                                             mock.DALMapperMockFactory.DALHandlerPipelineStepMapperMock,
                                             mock.BOLMapperMockFactory.BOLOtherTransportMapperMock,
                                             mock.DALMapperMockFactory.DALOtherTransportMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.HandlerModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }