示例#1
0
        public void Insert_SellerBanned_ShouldFail()
        {
            var auction = FakeEntityFactory.CreateAuction();

            auction.Seller        = FakeEntityFactory.CreateSeller();
            auction.Seller.Person = FakeEntityFactory.CreatePerson();
            auction.Products.Add(FakeEntityFactory.CreateProduct());
            auction.Seller.Person.BanEndDate = DateTime.Now.Date.AddDays(1);

            var results = auctionServices.Insert(auction);

            Assert.AreEqual(1, results.Count);
            var res = results[0];

            Assert.AreEqual(ErrorMessages.SellerIsBanned, res.ErrorMessage);
        }
示例#2
0
        public void Insert_AuctionWithMultipleCategories_BothCategoriesInExcess_ShouldFail()
        {
            var auction = FakeEntityFactory.CreateAuction();

            auction.Seller        = FakeEntityFactory.CreateSeller();
            auction.Seller.Person = FakeEntityFactory.CreatePerson();
            var commonCategories = new List <Category> {
                FakeEntityFactory.CreateCategory(), FakeEntityFactory.CreateCategory()
            };

            auction.Products.Add(FakeEntityFactory.CreateProduct(commonCategories));
            auction.Seller.Auctions = CreateActiveAuctionsWithCategoriesInExcess(commonCategories).ToList();

            var results = auctionServices.Insert(auction);

            Assert.AreEqual(1, results.Count);
            var res = results[0];

            Assert.AreEqual(ErrorMessages.TooManyAuctionsStartedAndNotFinalizedForCategory, res.ErrorMessage);
        }
示例#3
0
        public void Initialize()
        {
            this.userProfile = FakeEntityFactory.CreateUserProfile();
            this.person      = FakeEntityFactory.CreatePerson();
            this.seller      = FakeEntityFactory.CreateSeller();
            this.auction     = FakeEntityFactory.CreateAuction();
            this.bidder      = FakeEntityFactory.CreateBidder();
            this.product     = FakeEntityFactory.CreateProduct();
            this.category    = FakeEntityFactory.CreateCategory();

            this.userProfileServices = new UserProfileService(new UserProfileRepository());
            this.personServices      = new PersonService(new PersonRepository());
            this.bidderServices      = new BidderService(new BidderRepository());
            this.sellerServices      = new SellerService(new SellerRepository());
            this.categoryServices    = new CategoryService(new CategoryRepository());
            this.bidServices         = new BidService(new BidRepository());
            this.productServices     = new ProductService(new ProductRepository());
            this.auctionServices     = new AuctionService(new AuctionRepository());

            using (var auctionDBContext = new AuctionDBContext())
            {
                auctionDBContext.Database.Delete();
            }
        }