public async void DeleteAddressAsync_Deletes_One_Address_And_Returns_Number_Of_Deletions(int id)
        {
            //declare an Address
            Address address = _addresses.FirstOrDefault();

            //set repo return for getting the object to delete
            _mockRepository.Setup(repo => repo.GetOneByAsync(ad => ad.Id == id))
            .ReturnsAsync(address);

            //set mockRepo return for Delete action
            _mockRepository.Setup(repo => repo.DeleteTAsync(address)).ReturnsAsync(1);

            //instantiate the controller, passing the repo object
            var controller = new AddressesController(_mockRepository.Object, _mapper, _logger);

            //Call the controller method
            var actionResult = await controller.DeleteAddressAsync(id);

            //Get the int result
            var okObjectResult = actionResult.Result as OkObjectResult;
            var statusCode     = okObjectResult.StatusCode;
            int actualDeleted  = (int)okObjectResult.Value;

            //Assert the result
            Assert.NotNull(actionResult);

            //Validate StatusCode
            Assert.Equal(200, statusCode);

            //Validate the number of Addresses deleted
            Assert.Equal(1, actualDeleted);
        }
        public async void DeleteAddressAsync_Returns_NotFound_404_When_Delete_With_non_existent_Id(int id)
        {
            //declare null address
            Address address = null;

            //response error message:
            string expectedResponseMessage = "No Address was found";

            //set repo return for getting the object to delete
            _mockRepository.Setup(repo => repo.GetOneByAsync(ad => ad.Id == id)).ReturnsAsync(address);

            //set mockRepo return for Delete action
            _mockRepository.Setup(repo => repo.DeleteTAsync(null)).ReturnsAsync(0);

            //instantiate the controller, and call the method
            var controller = new AddressesController(_mockRepository.Object, _mapper, _logger);

            //Create Custom ControllerContext and add it to Controller for logging in the Controller in case of error
            controller.ControllerContext = new ControllerContextModel();

            //Call the controller method
            var actionResult = await controller.DeleteAddressAsync(id);

            //Get the int result
            var    notFoundObjectResult  = actionResult.Result as NotFoundObjectResult;
            var    statusCode            = notFoundObjectResult.StatusCode;
            string actualResponseMessage = (string)notFoundObjectResult.Value;

            //Assert the result
            Assert.NotNull(actionResult);

            //Validate StatusCode
            Assert.Equal(404, statusCode);

            //Validate result
            Assert.Equal(expectedResponseMessage, actualResponseMessage);
        }