public void TestActionServiceInOnlyMappingDatabaseOk(int num, bool hasErrors) { //SETUP var options = SqliteInMemory.CreateOptions <TestDbContext>(); using (var context = new TestDbContext(options)) { context.Database.EnsureCreated(); var mapper = SetupHelpers.CreateMapper <ServiceLayerBizInDto, ServiceLayerBizOutDto>(); var bizInstance = new BizActionInOnlyWriteDb(context); var runner = new ActionServiceInOnly <IBizActionInOnlyWriteDb, BizDataIn>(true, _noCachingConfig); var inDto = new ServiceLayerBizInDto { Num = num }; //ATTEMPT runner.RunBizActionDbAndInstance(context, bizInstance, mapper, inDto); //VERIFY bizInstance.HasErrors.ShouldEqual(hasErrors); if (hasErrors) { context.LogEntries.Any().ShouldBeFalse(); } else { context.LogEntries.Single().LogText.ShouldEqual(num.ToString()); } } }
public void TestActionServiceInOnlyMappingOk(int num, bool hasErrors) { //SETUP var mapper = SetupHelpers.CreateMapper <ServiceLayerBizInDto, ServiceLayerBizOutDto>(); var bizInstance = new BizActionInOnly(); var runner = new ActionServiceInOnly <IBizActionInOnly, BizDataIn>(false, _noCachingConfig); var inDto = new ServiceLayerBizInDto { Num = num }; //ATTEMPT runner.RunBizActionDbAndInstance(_dbContext, bizInstance, mapper, inDto); //VERIFY bizInstance.HasErrors.ShouldEqual(hasErrors); }
public void TestActionServiceInOnlyNoDtoOk(int num, bool hasErrors) { //SETUP var utData = NonDiBizSetup.SetupDtoMapping <ServiceLayerBizInDto>(_noCachingConfig); var bizInstance = new BizActionInOnly(); var runner = new ActionServiceInOnly <IBizActionInOnly, BizDataIn>(false, utData.WrappedConfig); var input = new BizDataIn { Num = num }; //ATTEMPT runner.RunBizActionDbAndInstance(_dbContext, bizInstance, input); //VERIFY bizInstance.HasErrors.ShouldEqual(hasErrors); }
public void TestActionServiceInOnlyNoDtoOk(int num, bool hasErrors) { //SETUP var mapper = SetupHelpers.CreateMapper <ServiceLayerBizInDto>(); //doesn't need a mapper, but mapper msutn't be null var bizInstance = new BizActionInOnly(); var runner = new ActionServiceInOnly <IBizActionInOnly, BizDataIn>(false, _noCachingConfig); var input = new BizDataIn { Num = num }; //ATTEMPT runner.RunBizActionDbAndInstance(_dbContext, bizInstance, mapper, input); //VERIFY bizInstance.HasErrors.ShouldEqual(hasErrors); }