public async Task <HttpResponseMessage> DeleteHardware(DeleteHardwareByIdRequest deleteHardwareRequest) { var content = IntegrationHttpRequest.CreateQuery(deleteHardwareRequest); HttpResponseMessage response = await client.DeleteAsync(UrlBase + String.Format("api/v1/delete-hardware?{0}", content)); return(response); }
public async Task <bool> DeleteHardwareByIdAsync(DeleteHardwareByIdRequest request) { var result = await DeleteAsync <DomainModel.Hardware>(request.Id); await SaveAsync(); return(result); }
public async Task TestDeleteDevice(DeleteHardwareByIdRequest delcom, ObjectResult resultAction, bool elementCreated = false) { Guid createdtransactionId = HardwareComponentsValues.GetHardwareAviability(); delcom.Id = elementCreated == true ? createdtransactionId : delcom.Id; HttpResponseMessage actionResult = await _hardwareAPI.DeleteHardware(delcom); base.CheckAssert(actionResult, resultAction); }
public async Task TestDeleteHardware(DeleteHardwareByIdRequest delnot, ObjectResult resultAction, bool elementCreated = false) { HardwareResponse defaultHardware = await this.CreatedDefaultHardware(); //Guid createdtransactionId = CompanyComponentsValues.GetCompanyAviability(); delnot.Id = elementCreated == true ? defaultHardware.Id : delnot.Id; IActionResult actionResult = await this.DeleteHardware(delnot); base.CheckAssert(actionResult, resultAction); }
private async Task <IActionResult> DeleteHardware(DeleteHardwareByIdRequest deleteHardwareRequest) { var options = new DbContextOptionsBuilder <Context>() .UseInMemoryDatabase(databaseName: "Hardware") .Options; // Run the test against one instance of the context using (var context = new Context(options)) { var repository = new HardwareRepository(context, AutomapperSingleton.Mapper); var service = new HardwareService(repository, AutomapperSingleton.Mapper); var controller = new HardwareController(service); Mock <HttpRequest> mockCreateRequest = MockHttpRequest.CreateMockQuery(deleteHardwareRequest.Id); return(await controller.DeleteHardwareAsync(mockCreateRequest.Object, _logger)); //as GridController; } }
public async Task <bool> DeleteHardwareByIdAsync(DeleteHardwareByIdRequest request) { var result = await _hardwareRepository.DeleteHardwareByIdAsync(request); return(result); }