public void TestGetDtoGenericActionsDtoAsyncBad() { //SETUP var service = new ActionService <IBizActionInOut>(_emptyDbContext, new BizActionInOut(), _mapper, _noCachingConfig); //ATTEMPT var ex = Assert.Throws <InvalidOperationException>(() => service.GetDto <ServiceLayerBizInDtoAsync>()); //VERIFY ex.Message.ShouldEqual("You cannot use an Async version of the DTO in a non-async action."); }
public void TestGetDtoGenericActionsDtoOutOnlyBad() { //SETUP var service = new ActionService <IBizActionOutOnly>(_emptyDbContext, new BizActionOutOnly(), _mapper, _noCachingConfig); //ATTEMPT var ex = Assert.Throws <InvalidOperationException>(() => service.GetDto <ServiceLayerBizInDto>()); //VERIFY ex.Message.ShouldEqual("The action with interface of IBizActionOutOnly does not have an input, but you called it with a method that needs an input."); }
public void TestGetDtoGenericActionsDtoBad() { //SETUP var service = new ActionService <IBizActionInOut>(_emptyDbContext, new BizActionInOut(), _mapper, _noCachingConfig); //ATTEMPT var ex = Assert.Throws <InvalidOperationException>(() => service.GetDto <ServiceLayerBizOutDto>()); //VERIFY ex.Message.ShouldEqual("Indirect copy to biz action. from type = ServiceLayerBizOutDto, to type BizDataIn. Expected a DTO of type GenericActionToBizDto<BizDataIn,ServiceLayerBizOutDto>"); }
public void TestGetDtoGenericActionsWithParamDtoOk() { //SETUP var service = new ActionService <IBizActionInOut>(_emptyDbContext, new BizActionInOut(), _mapper, _noCachingConfig); //ATTEMPT var data = service.GetDto <ServiceLayerBizInDto>(x => { x.Num = 2; }); //VERIFY data.Num.ShouldEqual(2); data.SetupSecondaryDataCalled.ShouldEqual(true); }
public void TestGetDtoDirectOk() { //SETUP var service = new ActionService <IBizActionInOut>(_emptyDbContext, new BizActionInOut(), _mapper, _noCachingConfig); //ATTEMPT var data = service.GetDto <BizDataIn>(); //VERIFY data.ShouldNotBeNull(); data.ShouldBeType <BizDataIn>(); }
public void TestGetDtoGenericActionsDtoOk() { //SETUP var service = new ActionService <IBizActionInOut>(_emptyDbContext, new BizActionInOut(), _mapper, _noCachingConfig); //ATTEMPT var data = service.GetDto <ServiceLayerBizInDto>(); //VERIFY data.ShouldNotBeNull(); data.ShouldBeType <ServiceLayerBizInDto>(); data.SetupSecondaryDataCalled.ShouldEqual(true); }
public void TestActionServiceErrorInSetupOk() { //SETUP var bizInstance = new BizActionInOut(); var runner = new ActionService <IBizActionInOut>(_emptyDbContext, bizInstance, _wrappedConfig); var input = runner.GetDto <ServiceLayerBizInDto>(x => { x.RaiseErrorInSetupSecondaryData = true; }); //ATTEMPT runner.RunBizAction <ServiceLayerBizOutDto>(input); //VERIFY bizInstance.HasErrors.ShouldEqual(true); bizInstance.Errors.Single().ErrorResult.ErrorMessage.ShouldEqual("Error in SetupSecondaryData"); }