public async Task InsertListing_OperationSuccess()
        {
            // Arrange
            _listingServiceMock.Setup(x => x.InsertListing(_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 newListingId = await controller.InsertListing(_sampleListing);

            // Assert
            newListingId.Should().Be(1);
        }
        public async Task InsertListing_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.InsertListing(_sampleListing));

            ex.Message.Should().Be("Attempted to perform an unauthorized operation.");
        }
        public async Task InsertListing_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.InsertListing(null));

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