public async Task <HttpResponseMessage> DeleteDevice(DeleteDeviceByIdRequest deleteUserRequest) { var content = IntegrationHttpRequest.CreateQuery(deleteUserRequest); HttpResponseMessage response = await client.DeleteAsync(UrlBase + String.Format("api/v1/delete-device?{0}", content)); return(response); }
public async Task <bool> DeleteDeviceByIdAsync(DeleteDeviceByIdRequest request) { var result = await DeleteAsync <DomainModel.Device>(request.Id); await SaveAsync(); return(result); }
public async Task TestDeleteDevice(DeleteDeviceByIdRequest delcom, ObjectResult resultAction, bool elementCreated = false) { Guid createdtransactionId = DeviceComponentsValues.GetDeviceAviability(); delcom.Id = elementCreated == true ? createdtransactionId : delcom.Id; HttpResponseMessage actionResult = await _deviceAPI.DeleteDevice(delcom); base.CheckAssert(actionResult, resultAction); }
public async Task TestDeleteNotification(DeleteDeviceByIdRequest delnot, ObjectResult resultAction, bool elementCreated = false) { DeviceResponse defaultNotification = await this.CreatedDefaultDevice(); //Guid createdtransactionId = CompanyComponentsValues.GetCompanyAviability(); delnot.Id = elementCreated == true ? defaultNotification.Id : delnot.Id; IActionResult actionResult = await this.DeleteDevice(delnot); base.CheckAssert(actionResult, resultAction); }
private async Task <IActionResult> DeleteDevice(DeleteDeviceByIdRequest deleteDeviceRequest) { var options = new DbContextOptionsBuilder <Context>() .UseInMemoryDatabase(databaseName: "Device") .Options; // Run the test against one instance of the context using (var context = new Context(options)) { var repository = new DeviceRepository(context, AutomapperSingleton.Mapper); var service = new DeviceService(repository, AutomapperSingleton.Mapper); var controller = new DeviceController(service); Mock <HttpRequest> mockCreateRequest = MockHttpRequest.CreateMockQuery(deleteDeviceRequest.Id); return(await controller.DeleteDeviceAsync(mockCreateRequest.Object, _logger)); //as GridController; } }
public async Task <bool> DeleteDeviceByIdAsync(DeleteDeviceByIdRequest request) { var result = await _deviceRepository.DeleteDeviceByIdAsync(request); return(result); }