Пример #1
0
        public async Task <HttpResponseMessage> UpdateSoftware(UpdateSoftwareRequest updateSoftwareRequest)
        {
            var content = IntegrationHttpRequest.CreateContentRequest(updateSoftwareRequest);
            HttpResponseMessage response = await client.PutAsync(UrlBase + "api/v1/update-software", content);

            return(response);
        }
        public async Task <bool> UpdateSoftwareAsync(UpdateSoftwareRequest request)
        {
            var result = await UpdateAsync(_mapper.Map <DomainModel.Software>(request));

            await SaveAsync();

            return(result);
        }
        public async Task TestUpdateSoftware(UpdateSoftwareRequest obj, ObjectResult resultAction, bool elementCreated = false)
        {
            var createdcompanyId = SoftwareComponentsValues.GetSoftwareAviability();

            obj.Id = elementCreated == true ? createdcompanyId : obj.Id;

            HttpResponseMessage actionResult = await _softwareAPI.UpdateSoftware(obj);

            base.CheckAssert(actionResult, resultAction);
        }
        public async Task TestUpdateDevice(UpdateSoftwareRequest obj, ObjectResult resultAction, bool elementCreated = false)
        {
            SoftwareResponse defaultCompany = await this.CreatedDefaultSoftware();

            obj.Id = elementCreated == true ? defaultCompany.Id : obj.Id;

            IActionResult actionResult = await this.UpdateSoftware(obj);

            base.CheckAssert(actionResult, resultAction);
        }
        private async Task <IActionResult> UpdateSoftware(UpdateSoftwareRequest updateSoftwareRequest)
        {
            var options = new DbContextOptionsBuilder <Context>()
                          .UseInMemoryDatabase(databaseName: "Software")
                          .Options;



            // Run the test against one instance of the context
            using (var context = new Context(options))
            {
                var repository = new SoftwareRepository(context, AutomapperSingleton.Mapper);
                var service    = new SoftwareService(repository, AutomapperSingleton.Mapper);
                var controller = new SoftwareController(service);

                Mock <HttpRequest> mockCreateRequest = MockHttpRequest.CreateMockRequest(updateSoftwareRequest);
                return(await controller.UpdateSoftwareAsync(mockCreateRequest.Object, _logger)); //as GridController;
            }
        }
Пример #6
0
        public async Task <bool> UpdateSoftwareAsync(UpdateSoftwareRequest request)
        {
            var result = await _softwareRepository.UpdateSoftwareAsync(request);

            return(result);
        }