public async Task <HardwareResponse> GetHardwareByIdAsync(GetHardwareByIdRequest request) { return(await GetAsync <DomainModel.Hardware>() .Where(x => x.Id == request.Id) .ProjectTo <HardwareResponse>(_mapper.ConfigurationProvider) .FirstOrDefaultAsync()); }
public async Task TestGetDevice(GetHardwareByIdRequest com, ObjectResult resultAction, bool elementCreated = false) { Guid createdcompanyId = HardwareComponentsValues.GetHardwareAviability(); com.Id = elementCreated == true ? createdcompanyId : com.Id; HttpResponseMessage actionResult = await _hardwareAPI.GetHardwareById(com); base.CheckAssert(actionResult, resultAction); }
public async Task <HttpResponseMessage> GetHardwareById(GetHardwareByIdRequest 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-hardware-by-id?{0}", content)); return(response); }
public async Task TestGetHardware(GetHardwareByIdRequest getcom, ObjectResult resultAction, bool elementCreated = false) { HardwareResponse defaultHardware = await this.CreatedDefaultHardware(); getcom.Id = elementCreated == true ? defaultHardware.Id : getcom.Id; IActionResult actionResult = await this.GetHardwareById(getcom); base.CheckAssert(actionResult, resultAction); }
private async Task <IActionResult> GetHardwareById(GetHardwareByIdRequest getHardwareRequest) { 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> mockGetRequest = MockHttpRequest.CreateMockQuery(getHardwareRequest.Id); return(await controller.GetHardwareByIdAsync(mockGetRequest.Object, _logger)); //as GridController; } }
public async Task <HardwareResponse> GetHardwareByIdAsync(GetHardwareByIdRequest request) { var result = await _hardwareRepository.GetHardwareByIdAsync(request); return(result); }