Beispiel #1
0
        public void TestMethod1()
        {
            AmazonRepository repository = new AmazonRepository();
            int totalpages;
            var items = repository.ItemSearch("potter stone yellow", 1, 13, out totalpages);

            Assert.IsNotNull(items);
            Assert.AreEqual(13, items.Count);
            Assert.IsTrue(totalpages == 2);
            Assert.IsNotNull(items[0].ItemAttributes.ListPrice.FormattedPrice);
            Assert.IsNotNull(items[0].Offers.Offer[0].OfferListing[0].Price.FormattedPrice);
        }
        public void Setup()
        {
            service = new RedisInside.Redis(config => config.Port(6666));

            var collection = new ServiceCollection();

            collection.AddLogging(builder => builder.AddConsole());
            collection.RegisterModule(new RedisModule(new NullLogger <RedisModule>(), new RedisConfiguration("localhost", 6666)));
            collection.RegisterModule <CommonModule>();
            var provider = collection.BuildServiceProvider();

            link = provider.GetService <IRedisLink>();
            link.Open();
            instance = new AmazonRepository(new NullLogger <AmazonRepository>(), link);
            review   = AmazonReview.Construct(
                new ProductData {
                Id = "Product1"
            },
                new UserData {
                Id = "User1"
            },
                new AmazonReviewData {
                Id = "One", UserId = "User1", ProductId = "Product1"
            },
                new AmazonTextData {
                Text = "Test"
            });
            review.User.Name        = "Andrius";
            review.Product.Name     = "Nokia";
            review.Product.Category = ProductCategory.Electronics;
            review.Data.Date        = new DateTime(2012, 01, 01);
            review.Product.Price    = 10;
            var task1 = instance.Save(review);

            review.Data.Id = "Two";
            review         = AmazonReview.Construct(review.Product, review.User, review.Data, review.TextData);
            var task2 = instance.Save(review);

            Task.WaitAll(task1, task2);
        }