public async Task UpdateListing_OperationSuccess()
        {
            // Arrange
            _listingServiceMock.Setup(x => x.UpdateListing(_sampleListing)).ReturnsAsync(1);
            _authorizationServiceMock.Setup(
                x => x.AuthorizeAsync(It.IsAny <ClaimsPrincipal>(), It.IsAny <object>(), It.IsAny <IEnumerable <IAuthorizationRequirement> >()))
            .ReturnsAsync(AuthorizationResult.Success);

            var controller = new ListingController(_listingServiceMock.Object, _mapperMock, _appSettingMock.Object,
                                                   _loggerMock.Object,
                                                   _authorizationServiceMock.Object, _imageServiceMock.Object, _bookingServiceMock.Object, _deviceMock.Object,
                                                   _imageStorageMock.Object);

            // Action
            var records = await controller.UpdateListing(1, _sampleListing);

            // Assert
            records.Should().Be(1);
        }
        public async Task UpdateListing_ExpectUnauthorizedException()
        {
            // Arrange
            _authorizationServiceMock.Setup(
                x => x.AuthorizeAsync(It.IsAny <ClaimsPrincipal>(), It.IsAny <object>(), It.IsAny <IEnumerable <IAuthorizationRequirement> >()))
            .ReturnsAsync(AuthorizationResult.Failed);

            var controller = new ListingController(_listingServiceMock.Object, _mapperMock, _appSettingMock.Object,
                                                   _loggerMock.Object,
                                                   _authorizationServiceMock.Object, _imageServiceMock.Object, _bookingServiceMock.Object, _deviceMock.Object,
                                                   _imageStorageMock.Object);

            // Assert
            var ex = await Assert.ThrowsAsync <UnauthorizedAccessException>(async() => await controller.UpdateListing(1, _sampleListing));

            ex.Message.Should().Be("Attempted to perform an unauthorized operation.");
        }
        public async Task UpdateListing_ExpectArgumentNullException()
        {
            // Arrange
            var controller = new ListingController(_listingServiceMock.Object, _mapperMock, _appSettingMock.Object,
                                                   _loggerMock.Object,
                                                   _authorizationServiceMock.Object, _imageServiceMock.Object, _bookingServiceMock.Object, _deviceMock.Object,
                                                   _imageStorageMock.Object);

            // Assert
            var ex = await Assert.ThrowsAsync <ArgumentNullException>(async() => await controller.UpdateListing(0, null));

            ex.Message.Should().Be("Value cannot be null.\r\nParameter name: listing");
        }