Exemplo n.º 1
0
        public void Create()
        {
            var productRepository = new ProductRepository();
            var productResult     = productRepository.Create("test", new DateTime(2000, 7, 7));
            var wordRepository    = new SearchWordRepository();
            var word = wordRepository.Create(productResult, "word");

            wordRepository = new SearchWordRepository();
            var wordResult = wordRepository.Read(word.SearchWordId);

            wordResult.IsNotNull();
            wordResult.Product.ProductId.Is(productResult.ProductId);
            wordResult.Word.Is("word");
            productRepository = new ProductRepository();
            productResult     = productRepository.Read(productResult.ProductId);
            productResult.SearchWords.Any(p => p.SearchWordId == wordResult.SearchWordId).IsTrue();
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            base.Initialize();
            using (var productRepository = new ProductRepository())
                using (var searchResultRepository = new SearchResultRepository())
                    using (var searchWordRepository = new SearchWordRepository())
                    {
                        var product1 = productRepository.Create("TestProduct1", new DateTime(2001, 1, 1));
                        var product2 = productRepository.Create("TestProduct2", new DateTime(2002, 2, 2));


                        var searchWord2 = searchWordRepository.Create(product2, "SearchWord1");
                        searchResultRepository.Create(searchWord2, product2, 100, new DateTime(2010, 1, 1));
                        searchResultRepository.Create(searchWord2, product2, 200, new DateTime(2010, 1, 2));

                        var product3 = productRepository.Create("TestProduct3", new DateTime(2003, 3, 3));
                    }
        }