Exemple #1
0
        public async Task <HttpResponseMessage> DeleteHardware(DeleteSoftwareByIdRequest deleteSoftwareRequest)
        {
            var content = IntegrationHttpRequest.CreateQuery(deleteSoftwareRequest);
            HttpResponseMessage response = await client.DeleteAsync(UrlBase + String.Format("api/v1/delete-software?{0}", content));

            return(response);
        }
        public async Task <bool> DeleteSoftwareByIdAsync(DeleteSoftwareByIdRequest request)
        {
            var result = await DeleteAsync <DomainModel.Software>(request.Id);

            await SaveAsync();

            return(result);
        }
        public async Task TestDeleteSoftware(DeleteSoftwareByIdRequest delcom, ObjectResult resultAction, bool elementCreated = false)
        {
            Guid createdtransactionId = SoftwareComponentsValues.GetSoftwareAviability();

            delcom.Id = elementCreated == true ? createdtransactionId : delcom.Id;

            HttpResponseMessage actionResult = await _softwareAPI.DeleteHardware(delcom);

            base.CheckAssert(actionResult, resultAction);
        }
        public async Task TestDeleteHardware(DeleteSoftwareByIdRequest delnot, ObjectResult resultAction, bool elementCreated = false)
        {
            SoftwareResponse defaultHardware = await this.CreatedDefaultSoftware();

            //Guid createdtransactionId = CompanyComponentsValues.GetCompanyAviability();

            delnot.Id = elementCreated == true ? defaultHardware.Id : delnot.Id;

            IActionResult actionResult = await this.DeleteSoftware(delnot);

            base.CheckAssert(actionResult, resultAction);
        }
        private async Task <IActionResult> DeleteSoftware(DeleteSoftwareByIdRequest deleteSoftwareRequest)
        {
            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.CreateMockQuery(deleteSoftwareRequest.Id);
                return(await controller.DeleteSoftwareAsync(mockCreateRequest.Object, _logger)); //as GridController;
            }
        }
Exemple #6
0
        public async Task <bool> DeleteSoftwareByIdAsync(DeleteSoftwareByIdRequest request)
        {
            var result = await _softwareRepository.DeleteSoftwareByIdAsync(request);

            return(result);
        }