public async Task <PayRollGroupView> MapToView(PayRollGroup inputObject) { Mapper mapper = new Mapper(); PayRollGroupView outObject = mapper.Map <PayRollGroupView>(inputObject); await Task.Yield(); return(outObject); }
public async Task <PayRollGroup> MapToEntity(PayRollGroupView inputObject) { Mapper mapper = new Mapper(); PayRollGroup outObject = mapper.Map <PayRollGroup>(inputObject); await Task.Yield(); return(outObject); }
public async Task TestAddUpdatDeletePayRoll() { PayRollGroupModule PayRollGroupMod = new PayRollGroupModule(); PayRollGroupView view = new PayRollGroupView() { Description = "PayRollGroup Test", PayRollGroupCode = 99 }; NextNumber nnNextNumber = await PayRollGroupMod.PayRollGroup.Query().GetNextNumber(); view.PayRollGroupNumber = nnNextNumber.NextNumberValue; PayRollGroup payRollGroup = await PayRollGroupMod.PayRollGroup.Query().MapToEntity(view); PayRollGroupMod.PayRollGroup.AddPayRollGroup(payRollGroup).Apply(); PayRollGroup newPayRollGroup = await PayRollGroupMod.PayRollGroup.Query().GetEntityByNumber(view.PayRollGroupNumber); Assert.NotNull(newPayRollGroup); newPayRollGroup.Description = "PayRollGroup Test Update"; PayRollGroupMod.PayRollGroup.UpdatePayRollGroup(newPayRollGroup).Apply(); PayRollGroupView updateView = await PayRollGroupMod.PayRollGroup.Query().GetViewById(newPayRollGroup.PayRollGroupId); Assert.Same(updateView.Description, "PayRollGroup Test Update"); int code = 99; PayRollGroupView lookupByCode = await PayRollGroupMod.PayRollGroup.Query().GetViewByCode(code); Assert.NotNull(lookupByCode); PayRollGroupMod.PayRollGroup.DeletePayRollGroup(newPayRollGroup).Apply(); PayRollGroup lookupPayRollGroup = await PayRollGroupMod.PayRollGroup.Query().GetEntityById(view.PayRollGroupId); Assert.Null(lookupPayRollGroup); }