예제 #1
0
        public void TestActionServiceOutOnlyNoDtoOk()
        {
            //SETUP
            var mapper      = SetupHelpers.CreateMapper <ServiceLayerBizInDto>(); //doesn't need a mapper, but mapper msutn't be null
            var bizInstance = new BizActionOutOnly();
            var runner      = new ActionServiceOutOnly <IBizActionOutOnly, BizDataOut>(false, _noCachingConfig);

            //ATTEMPT
            var data = runner.RunBizActionDbAndInstance <BizDataOut>(_dbContext, bizInstance, mapper);

            //VERIFY
            bizInstance.HasErrors.ShouldBeFalse();
            data.Output.ShouldEqual("Result");
        }
예제 #2
0
        public void TestActionServiceOutOnlyNoDtoOk()
        {
            //SETUP
            var utData      = NonDiBizSetup.SetupDtoMapping <ServiceLayerBizInDto>(_noCachingConfig);
            var bizInstance = new BizActionOutOnly();
            var runner      = new ActionServiceOutOnly <IBizActionOutOnly, BizDataOut>(false, utData.WrappedConfig);

            //ATTEMPT
            var data = runner.RunBizActionDbAndInstance <BizDataOut>(_dbContext, bizInstance);

            //VERIFY
            bizInstance.HasErrors.ShouldBeFalse();
            data.Output.ShouldEqual("Result");
        }
예제 #3
0
        public void TestActionServiceOutOnlyMappingDatabaseOk()
        {
            //SETUP
            var options = SqliteInMemory.CreateOptions <TestDbContext>();

            using (var context = new TestDbContext(options))
            {
                context.Database.EnsureCreated();

                var mapper      = SetupHelpers.CreateMapper <ServiceLayerBizOutDto>();
                var bizInstance = new BizActionOutOnlyWriteDb(context);
                var runner      = new ActionServiceOutOnly <IBizActionOutOnlyWriteDb, BizDataOut>(true, _noCachingConfig);

                //ATTEMPT
                var data = runner.RunBizActionDbAndInstance <ServiceLayerBizOutDto>(context, bizInstance, mapper);

                //VERIFY
                bizInstance.HasErrors.ShouldBeFalse();
                context.LogEntries.Single().LogText.ShouldEqual("BizActionOutOnlyWriteDb");
            }
        }