private async Task <OperativeSystemResponse> CreatedDefaultOperativeSystem() { CreateOperativeSystemRequest hardware = OperativeSystemComponentsValues.CreateOperativeSystemRequestBasic(); var request = AutomapperSingleton.Mapper.Map <OperativeSystemResponse>(hardware); IActionResult actionResult = await CreateOperativeSystem(hardware); ObjectResult objectResult = actionResult is ObjectResult ? actionResult as ObjectResult : null; if (objectResult != null && objectResult.Value is Guid) { var identifier = objectResult.Value as Guid?; if (identifier.HasValue) { request.Id = identifier.Value; } else { Assert.Fail("Return value isn't a identifier valid"); } } else { Assert.Fail("Imposible create default record"); } return(request); }
public async Task TestDeleteOperativeSystem(DeleteOperativeSystemByIdRequest delcom, ObjectResult resultAction, bool elementCreated = false) { Guid createdtransactionId = OperativeSystemComponentsValues.GetOperativeSystemAviability(); delcom.Id = elementCreated == true ? createdtransactionId : delcom.Id; HttpResponseMessage actionResult = await _operativeSystemAPI.DeleteOperativeSystem(delcom); base.CheckAssert(actionResult, resultAction); }
public async Task TestUpdateOperativeSystem(UpdateOperativeSystemRequest obj, ObjectResult resultAction, bool elementCreated = false) { var createdcompanyId = OperativeSystemComponentsValues.GetOperativeSystemAviability(); obj.Id = elementCreated == true ? createdcompanyId : obj.Id; HttpResponseMessage actionResult = await _operativeSystemAPI.UpdateOperativeSystem(obj); base.CheckAssert(actionResult, resultAction); }