コード例 #1
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>();
        }
コード例 #2
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>();
        }
コード例 #3
0
        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;
        }
コード例 #4
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>();
        }