public async Task TestResetDtoDirectOk() { //SETUP var service = new ActionServiceAsync <IBizActionInOutAsync>(_emptyDbContext, new BizActionInOutAsync(), _mapper, _noCachingConfig); var data = new BizDataIn { Num = 123 }; //ATTEMPT await service.ResetDtoAsync(data); //VERIFY data.ShouldNotBeNull(); data.Num.ShouldEqual(123); }
public async Task Test11ResetDtoGenericActionsOk() { //SETUP var service = new ActionServiceAsync <IBizActionInOutAsync>(_emptyDbContext, new BizActionInOutAsync(), _mapper, _noCachingConfig); var data = new ServiceLayerBizInDto { Num = 123 }; //ATTEMPT await service.ResetDtoAsync(data); //VERIFY data.ShouldNotBeNull(); data.Num.ShouldEqual(123); data.SetupSecondaryDataCalled.ShouldBeTrue(); }
public async Task TestResetDtoGenericActionsDtoOutNotInBad() { //SETUP var service = new ActionServiceAsync <IBizActionInOutAsync>(_emptyDbContext, new BizActionInOutAsync(), _mapper, _noCachingConfig); var data = new ServiceLayerBizOutDto(); //ATTEMPT var ex = await Assert.ThrowsAsync <InvalidOperationException>(async() => await service.ResetDtoAsync(data)); //VERIFY ex.Message.ShouldEqual("Indirect copy to biz action. from type = ServiceLayerBizOutDto, to type BizDataIn. Expected a DTO of type GenericActionToBizDto<BizDataIn,ServiceLayerBizOutDto>"); }
public async Task TestResetDtoGenericActionsDtoBad() { //SETUP var service = new ActionServiceAsync <IBizActionOutOnly>(_emptyDbContext, new BizActionOutOnly(), _mapper, _noCachingConfig); var data = new ServiceLayerBizInDto(); //ATTEMPT var ex = await Assert.ThrowsAsync <InvalidOperationException>(async() => await service.ResetDtoAsync(data)); //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."); }