public async Task <DeviceResponse> GetDeviceByIdAsync(GetDeviceByIdRequest request) { return(await GetAsync <DomainModel.Device>() .Where(x => x.Id == request.Id) .ProjectTo <DeviceResponse>(_mapper.ConfigurationProvider) .FirstOrDefaultAsync()); }
public async Task <HttpResponseMessage> GetDeviceById(GetDeviceByIdRequest getDeviceByIdRequest) { //getCompanyRequest.Id = Guid.Parse("6383ff38-92f9-4bda-e61a-08d783dd9ba7"); var content = IntegrationHttpRequest.CreateQuery(getDeviceByIdRequest); HttpResponseMessage response = await client.GetAsync(UrlBase + String.Format("api/v1/get-device-by-id?{0}", content)); return(response); }
public async Task TestGetDevice(GetDeviceByIdRequest getcom, ObjectResult resultAction, bool elementCreated = false) { DeviceResponse defaultNotification = await this.CreatedDefaultDevice(); getcom.Id = elementCreated == true ? defaultNotification.Id : getcom.Id; IActionResult actionResult = await this.GetDeviceById(getcom); base.CheckAssert(actionResult, resultAction); }
public async Task TestGetDevice(GetDeviceByIdRequest com, ObjectResult resultAction, bool elementCreated = false) { Guid createdcompanyId = DeviceComponentsValues.GetDeviceAviability(); com.Id = elementCreated == true ? createdcompanyId : com.Id; HttpResponseMessage actionResult = await _deviceAPI.GetDeviceById(com); base.CheckAssert(actionResult, resultAction); }
private async Task <IActionResult> GetDeviceById(GetDeviceByIdRequest getDeviceRequest) { 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> mockGetRequest = MockHttpRequest.CreateMockQuery(getDeviceRequest.Id); return(await controller.GetDeviceByIdAsync(mockGetRequest.Object, _logger)); //as GridController; } }
public async Task <DeviceResponse> GetDeviceByIdAsync(GetDeviceByIdRequest request) { var result = await _deviceRepository.GetDeviceByIdAsync(request); return(result); }