Example #1
0
        public static void Create()
        {
            var dbProvider = new PersistentDbProvider(new ServerConfiguration {DatabaseAddress = "http://localhost:8080/"});
            new ShopRepository(dbProvider).CreateShop("Sample");
            var productRepository = new ProductRepository(dbProvider);

            for (int i = 0; i < 1000; i++)
                productRepository.Create(GetRandomProduct());
        }
Example #2
0
        public void CanCreateProducts()
        {
            var dbProvider = new InMemoryDbProvider();

            var shopManager = new ShopRepository(dbProvider);
            shopManager.CreateShop("Test");

            var productRepo = new ProductRepository(dbProvider);
            productRepo.Create(new Product
            {
                Title = "First product"
            });

            var product = productRepo.GetProductByTitle("First product");

            Assert.IsNotNull(product);
            Assert.AreEqual("First product", product.Title);
        }