private BookUpdateCommand CreateTestCommand(
     Guid bookId,
     CompletionStatusReference completionStatus,
     bool isCheckedOut,
     bool isReissue,
     int timesCompleted,
     Guid userId) =>
Beispiel #2
0
        public void Command_Throws_If_Artist_Is_Missing(
            Guid albumId,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            DateTimeOffset purchasedOn,
            int discogsId,
            string genre,
            bool hasDigitalDownload,
            string imageUrl,
            bool isNewPurchase,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string locationPurchased,
            MediaTypeReference mediaType,
            string notes,
            string recordLabel,
            int?reissueYear,
            SizeReference size,
            SpeedReference speed,
            string style,
            int timesCompleted,
            string title,
            int yearReleasedOn)
        {
            Action createWithMissingArtist = () => new AlbumUpdateCommand(
                albumId,
                string.Empty,
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                discogsId,
                genre,
                hasDigitalDownload,
                imageUrl,
                isNewPurchase,
                isPhysical,
                isReissue,
                itemStorage,
                locationPurchased,
                mediaType,
                notes,
                purchasedOn,
                recordLabel,
                reissueYear,
                size,
                speed,
                style,
                timesCompleted,
                title,
                yearReleasedOn,
                _testUser);

            createWithMissingArtist.Should().Throw <ArgumentException>();
        }
Beispiel #3
0
        public MovieUpdateRequest(
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            string director,
            string distributor,
            string genre,
            string imageUrl,
            bool isNew,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string language,
            string locationPurchased,
            Guid movieId,
            string notes,
            DateTimeOffset purchasedOn,
            MovieRatingReference rating,
            int?reissueYear,
            int seasonNumber,
            int timesCompleted,
            string title,
            int tmdbId,
            MovieMediaTypeReference type,
            ApplicationUser user,
            int yearReleasedOn)
            : base(
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                genre,
                imageUrl,
                isNew,
                isPhysical,
                isReissue,
                itemStorage,
                locationPurchased,
                notes,
                purchasedOn,
                reissueYear,
                timesCompleted,
                title,
                user,
                yearReleasedOn)
        {
            Guard.Against.Default(movieId, nameof(movieId));

            Director     = director;
            Distributor  = distributor;
            Language     = language;
            MovieId      = movieId;
            Rating       = rating;
            SeasonNumber = seasonNumber;
            TMDBId       = tmdbId;
            Type         = type;
        }
Beispiel #4
0
        public void Command_Throws_If_Title_Is_Missing(
            string author,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            DateTimeOffset purchasedOn,
            string genre,
            string imageUrl,
            string isbn10,
            string isbn13,
            bool isFirstEdition,
            bool isHardcover,
            bool isNewPurchase,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string language,
            string locationPurchased,
            string notes,
            int pageCount,
            string publisher,
            int?reissueYear,
            int timesCompleted,
            BookTypeReference type,
            int yearReleasedOn)
        {
            Action createWithMissingTitle = () => new BookSubmissionCommand(
                author,
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                genre,
                imageUrl,
                isbn10,
                isbn13,
                isFirstEdition,
                isHardcover,
                isNewPurchase,
                isPhysical,
                isReissue,
                itemStorage,
                language,
                locationPurchased,
                notes,
                pageCount,
                publisher,
                purchasedOn,
                reissueYear,
                timesCompleted,
                string.Empty,
                type,
                yearReleasedOn,
                _testUser);

            createWithMissingTitle.Should().Throw <ArgumentException>();
        }
        public void Commmand_Throws_If_User_Id_Is_Missing(
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            string director,
            string distributor,
            string genre,
            string imageUrl,
            bool isNew,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string language,
            string locationPurchased,
            string notes,
            DateTimeOffset purchasedOn,
            MovieRatingReference rating,
            int?reissueYear,
            int seasonNumber,
            int timesCompleted,
            string title,
            int tmdbId,
            MovieMediaTypeReference type,
            int yearReleasedOn)
        {
            Action createWithMissingUserId = () => new MovieSubmissionCommand(
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                director,
                distributor,
                genre,
                imageUrl,
                isNew,
                isPhysical,
                isReissue,
                itemStorage,
                language,
                locationPurchased,
                notes,
                purchasedOn,
                rating,
                reissueYear,
                seasonNumber,
                timesCompleted,
                title,
                tmdbId,
                type,
                new ApplicationUser {
                Id = Guid.Empty
            },
                yearReleasedOn);

            createWithMissingUserId.Should().Throw <ArgumentException>();
        }
Beispiel #6
0
        public void Request_Throws_If_ReissueYear_Is_Negative_And_IsReissue_Is_True(
            string artist,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            DateTimeOffset purchasedOn,
            int discogsId,
            string genre,
            bool hasDigitalDownload,
            string imageUrl,
            bool isNewPurchase,
            bool isPhysical,
            ItemStorageRequest itemStorage,
            string locationPurchased,
            MediaTypeReference mediaType,
            string notes,
            string recordLabel,
            SizeReference size,
            SpeedReference speed,
            string style,
            int timesCompleted,
            string title,
            int yearReleasedOn)
        {
            Action createWithNegativeReissueYearWhenIsReissueIsTrue = () => new AlbumSubmissionRequest(
                artist,
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                discogsId,
                genre,
                hasDigitalDownload,
                imageUrl,
                isNewPurchase,
                isPhysical,
                true,
                itemStorage,
                locationPurchased,
                mediaType,
                notes,
                purchasedOn,
                recordLabel,
                -1,
                size,
                speed,
                style,
                timesCompleted,
                title,
                yearReleasedOn,
                _testUser);

            createWithNegativeReissueYearWhenIsReissueIsTrue.Should().Throw <ArgumentException>();
        }
        public void Request_Throws_If_ReissueYear_Is_Negative_And_IsReissue_Is_True(
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            string director,
            string distributor,
            string genre,
            string imageUrl,
            bool isNew,
            bool isPhysical,
            ItemStorageRequest itemStorage,
            string language,
            string locationPurchased,
            Guid movieId,
            string notes,
            DateTimeOffset purchasedOn,
            MovieRatingReference rating,
            int seasonNumber,
            int timesCompleted,
            string title,
            int tmdbId,
            MovieMediaTypeReference type,
            int yearReleasedOn)
        {
            Action createWithNegativeReissueYearAndIsReissueTrue = () => new MovieUpdateRequest(
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                director,
                distributor,
                genre,
                imageUrl,
                isNew,
                isPhysical,
                true,
                itemStorage,
                language,
                locationPurchased,
                movieId,
                notes,
                purchasedOn,
                rating,
                -1,
                seasonNumber,
                timesCompleted,
                title,
                tmdbId,
                type,
                _testUser,
                yearReleasedOn);

            createWithNegativeReissueYearAndIsReissueTrue.Should().Throw <ArgumentException>();
        }
Beispiel #8
0
        protected BaseItemUpdateRequest(
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            string genre,
            string imageUrl,
            bool isNew,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string locationPurchased,
            string notes,
            DateTimeOffset purchasedOn,
            int?reissueYear,
            int timesCompleted,
            string title,
            ApplicationUser user,
            int yearReleasedOn)
        {
            Guard.Against.NullOrWhiteSpace(title, nameof(title));
            Guard.Against.Null(user, nameof(user));
            Guard.Against.Default(user.Id, nameof(user.Id));

            if (isReissue)
            {
                Guard.Against.Null(reissueYear, nameof(reissueYear));
                Guard.Against.NegativeOrZero(reissueYear.GetValueOrDefault(), nameof(reissueYear));
            }

            Category          = category;
            Checkout          = checkout;
            CompletionStatus  = completionStatus;
            CountryOfOrigin   = countryOfOrigin;
            CountryPurchased  = countryPurchased;
            Genre             = genre;
            ImageUrl          = imageUrl;
            IsNew             = isNew;
            IsPhysical        = isPhysical;
            IsReissue         = isReissue;
            ItemStorage       = itemStorage;
            LocationPurchased = locationPurchased;
            Notes             = notes;
            PurchasedOn       = purchasedOn;
            ReissueYear       = reissueYear;
            TimesCompleted    = timesCompleted;
            Title             = title;
            User           = user;
            YearReleasedOn = yearReleasedOn;
        }
Beispiel #9
0
        public AlbumUpdateCommand(
            Guid albumId,
            string artist,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            int discogsId,
            string genre,
            bool hasDigitalDownload,
            string imageUrl,
            bool isNew,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string locationPurchased,
            MediaTypeReference mediaType,
            string notes,
            DateTimeOffset purchasedOn,
            string recordLabel,
            int?reissueYear,
            SizeReference size,
            SpeedReference speed,
            string style,
            int timesCompleted,
            string title,
            int yearReleasedOn,
            ApplicationUser user)
        {
            Guard.Against.Default(albumId, nameof(albumId));
            Guard.Against.NullOrWhiteSpace(artist, nameof(artist));
            Guard.Against.NullOrWhiteSpace(title, nameof(title));
            Guard.Against.Null(user, nameof(user));
            Guard.Against.Default(user.Id, nameof(user.Id));

            AlbumId            = albumId;
            Artist             = artist;
            Category           = category;
            Checkout           = checkout;
            CompletionStatus   = completionStatus;
            CountryOfOrigin    = countryOfOrigin;
            CountryPurchased   = countryPurchased;
            DiscogsId          = discogsId;
            Genre              = genre;
            HasDigitalDownload = hasDigitalDownload;
            ImageUrl           = imageUrl;
            IsNew              = isNew;
            IsPhysical         = isPhysical;
            IsReissue          = isReissue;
            ItemStorage        = itemStorage;
            LocationPurchased  = locationPurchased;
            MediaType          = mediaType;
            Notes              = notes;
            PurchasedOn        = purchasedOn;
            RecordLabel        = recordLabel;
            ReissueYear        = reissueYear;
            Size           = size;
            Speed          = speed;
            Style          = style;
            TimesCompleted = timesCompleted;
            Title          = title;
            YearReleasedOn = yearReleasedOn;
            User           = user;
        }
Beispiel #10
0
        public GameUpdateCommand(
            int bggId,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            string developer,
            Guid gameId,
            string genre,
            int giantBombId,
            string imageUrl,
            bool isDlc,
            bool isNew,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string language,
            string locationPurchased,
            string notes,
            bool partOfSeries,
            GamePlatformReference platform,
            string publisher,
            DateTimeOffset purchasedOn,
            GameRatingReference rating,
            int?reissueYear,
            string series,
            int timesCompleted,
            string title,
            GameTypeReference type,
            ApplicationUser user,
            int yearReleasedOn)
            : base(
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                genre,
                imageUrl,
                isNew,
                isPhysical,
                isReissue,
                itemStorage,
                locationPurchased,
                notes,
                purchasedOn,
                reissueYear,
                timesCompleted,
                title,
                user,
                yearReleasedOn)
        {
            Guard.Against.Default(gameId, nameof(gameId));

            BGGId        = bggId;
            Developer    = developer;
            GameId       = gameId;
            GiantBombId  = giantBombId;
            IsDLC        = isDlc;
            Language     = language;
            PartOfSeries = partOfSeries;
            Platform     = platform;
            Publisher    = publisher;
            Rating       = rating;
            Series       = series;
            Type         = type;
        }
Beispiel #11
0
        public void Request_Throws_If_ReissueYear_Is_Negative_And_IsReissue_Is_True(
            string author,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            DateTimeOffset purchasedOn,
            string genre,
            string imageUrl,
            string isbn10,
            string isbn13,
            bool isFirstEdition,
            bool isHardcover,
            bool isNewPurchase,
            bool isPhysical,
            ItemStorageRequest itemStorage,
            string language,
            Guid linkedWishId,
            string locationPurchased,
            string notes,
            int pageCount,
            string publisher,
            int timesCompleted,
            string title,
            BookTypeReference type,
            int yearReleasedOn)
        {
            Action createNegativeReissueYearAndIsReissueTrue = () => new BookSubmissionRequest(
                author,
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                genre,
                imageUrl,
                isbn10,
                isbn13,
                isFirstEdition,
                isHardcover,
                isNewPurchase,
                isPhysical,
                true,
                itemStorage,
                language,
                linkedWishId,
                locationPurchased,
                notes,
                pageCount,
                publisher,
                purchasedOn,
                -1,
                timesCompleted,
                title,
                type,
                yearReleasedOn,
                _testUser);

            createNegativeReissueYearAndIsReissueTrue.Should().Throw <ArgumentException>();
        }
        public BookSubmissionRequest(
            string author,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            string genre,
            string imageUrl,
            string isbn10,
            string isbn13,
            bool isFirstEdition,
            bool isHardcover,
            bool isNewPurchase,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string language,
            Guid?linkedWishId,
            string locationPurchased,
            string notes,
            int pageCount,
            string publisher,
            DateTimeOffset purchasedOn,
            int?reissueYear,
            int timesCompleted,
            string title,
            BookTypeReference type,
            int yearReleasedOn,
            ApplicationUser user)
        {
            Guard.Against.NullOrWhiteSpace(author, nameof(author));
            Guard.Against.NullOrWhiteSpace(title, nameof(title));
            Guard.Against.Null(user, nameof(user));
            Guard.Against.Default(user.Id, nameof(user.Id));

            if (isReissue)
            {
                Guard.Against.Null(reissueYear, nameof(reissueYear));
                Guard.Against.NegativeOrZero(reissueYear.GetValueOrDefault(), nameof(reissueYear));
            }

            Author            = author;
            Category          = category;
            Checkout          = checkout;
            CompletionStatus  = completionStatus;
            CountryOfOrigin   = countryOfOrigin;
            CountryPurchased  = countryPurchased;
            Genre             = genre;
            ImageUrl          = imageUrl;
            ISBN10            = isbn10;
            ISBN13            = isbn13;
            IsFirstEdition    = isFirstEdition;
            IsHardcover       = isHardcover;
            IsNewPurchase     = isNewPurchase;
            IsPhysical        = isPhysical;
            IsReissue         = isReissue;
            ItemStorage       = itemStorage;
            Language          = language;
            LinkedWishId      = linkedWishId;
            LocationPurchased = locationPurchased;
            Notes             = notes;
            PageCount         = pageCount;
            Publisher         = publisher;
            PurchasedOn       = purchasedOn;
            ReissueYear       = reissueYear;
            TimesCompleted    = timesCompleted;
            Title             = title;
            Type           = type;
            YearReleasedOn = yearReleasedOn;
            User           = user;
        }
Beispiel #13
0
        public void Command_Throws_If_Title_Is_Missing(
            int bggId,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            string developer,
            Guid gameId,
            string genre,
            int giantBombId,
            string imageUrl,
            bool isDlc,
            bool isNew,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string language,
            string locationPurchased,
            string notes,
            bool partOfSeries,
            GamePlatformReference platform,
            string publisher,
            DateTimeOffset purchasedOn,
            GameRatingReference rating,
            int?reissueYear,
            string series,
            int timesCompleted,
            GameTypeReference type,
            int yearReleasedOn)
        {
            Action createWithMissingTitle = () => new GameUpdateCommand(
                bggId,
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                developer,
                gameId,
                genre,
                giantBombId,
                imageUrl,
                isDlc,
                isNew,
                isPhysical,
                isReissue,
                itemStorage,
                language,
                locationPurchased,
                notes,
                partOfSeries,
                platform,
                publisher,
                purchasedOn,
                rating,
                reissueYear,
                series,
                timesCompleted,
                string.Empty,
                type,
                _testUser,
                yearReleasedOn);

            createWithMissingTitle.Should().Throw <ArgumentException>();
        }
Beispiel #14
0
        public void Request_Throws_If_User_Is_Null(
            string author,
            Guid bookId,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            DateTimeOffset purchasedOn,
            string genre,
            string imageUrl,
            string isbn10,
            string isbn13,
            bool isFirstEdition,
            bool isHardcover,
            bool isNewPurchase,
            bool isPhysical,
            bool isReissue,
            ItemStorageRequest itemStorage,
            string language,
            string locationPurchased,
            string notes,
            int pageCount,
            string publisher,
            int?reissueYear,
            int timesCompleted,
            string title,
            BookTypeReference type,
            int yearReleasedOn)
        {
            Action createWithNullUser = () => new BookUpdateRequest(
                author,
                bookId,
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                genre,
                imageUrl,
                isbn10,
                isbn13,
                isFirstEdition,
                isHardcover,
                isNewPurchase,
                isPhysical,
                isReissue,
                itemStorage,
                language,
                locationPurchased,
                notes,
                pageCount,
                publisher,
                purchasedOn,
                reissueYear,
                timesCompleted,
                title,
                type,
                yearReleasedOn,
                null);

            createWithNullUser.Should().Throw <ArgumentException>();
        }
        public void Request_Throws_If_ReissueYear_Is_Null_And_IsReissue_Is_True(
            int bggId,
            string category,
            CheckoutRequest checkout,
            CompletionStatusReference completionStatus,
            string countryOfOrigin,
            string countryPurchased,
            string developer,
            string genre,
            int giantBombId,
            string imageUrl,
            bool isDlc,
            bool isNew,
            bool isPhysical,
            ItemStorageRequest itemStorage,
            string language,
            string locationPurchased,
            string notes,
            bool partOfSeries,
            GamePlatformReference platform,
            string publisher,
            DateTimeOffset purchasedOn,
            GameRatingReference rating,
            string series,
            int timesCompleted,
            string title,
            GameTypeReference type,
            int yearReleasedOn)
        {
            Action createWithNullReissueYearAndIsReissueTrue = () => new GameSubmissionRequest(
                bggId,
                category,
                checkout,
                completionStatus,
                countryOfOrigin,
                countryPurchased,
                developer,
                genre,
                giantBombId,
                imageUrl,
                isDlc,
                isNew,
                isPhysical,
                true,
                itemStorage,
                language,
                locationPurchased,
                notes,
                partOfSeries,
                platform,
                publisher,
                purchasedOn,
                rating,
                null,
                series,
                timesCompleted,
                title,
                type,
                _testUser,
                yearReleasedOn);

            createWithNullReissueYearAndIsReissueTrue.Should().Throw <ArgumentException>();
        }