예제 #1
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            DBInit.RegisterIndexes(Store);

            using (var tran = RepositoryFactory.StartTransaction())
            {
                var feed1 = new RssFeed
                                {
                                    Id = Guid.NewGuid(),
                                    Name = "feed1",
                                    Url = "some_test_url1",
                                    AuthorRegex = "author_regex",
                                    DisplayFullContent = true,
                                    GetDirectContent = false,
                                    ContentParseRegex = "content_parser"
                                };
                feed1.RssItems = new List<RssItem>
                                 	{
                                 		new RssItem
                                 			{
                                 				Id = Guid.NewGuid(),
                                 				RssFeed = feed1,
                                                Url = "feed_url1",
                                                Author = "unknown",
                                                Description = "Short_description",
                                                Text = "some_text",
                                                CreatedDate = DateTime.Now,
                                                Modified = DateTime.Now,
                                                PublishDate = DateTime.Now
                                            }
                                    };
                var feed2 = new RssFeed
                {
                    Id = Guid.NewGuid(),
                    Name = "feed2",
                    Url = "some_test_url2",
                    AuthorRegex = "author_regex",
                    DisplayFullContent = true,
                    GetDirectContent = false,
                    ContentParseRegex = "content_parser"
                };

                var feed3 = new RssFeed
                {
                    Id = Guid.NewGuid(),
                    Name = "feed3",
                    Url = "some_test_url3",
                    AuthorRegex = "author_regex",
                    DisplayFullContent = false,
                    GetDirectContent = true,
                    ContentParseRegex = "content_parser"
                };

                SessionFactory<RssFeed>.Store(feed1);
                SessionFactory<RssFeed>.Store(feed2);
                SessionFactory<RssFeed>.Store(feed3);
                foreach (var rssItem in feed1.RssItems)
                {
                    SessionFactory<RssItem>.Store(rssItem);
                }
                _testData = new[] { feed1, feed2, feed3 };
                tran.Commit();
            }
            WaitForIndexing();
        }
예제 #2
0
        public void Same_id_stored_to_different_class()
        {
            Guid id = Guid.NewGuid();
            var classOne = new RssFeed
                            {
                                Id = id,
                                Name = "test_feed",
                                Url = "some_test_url1",
                                AuthorRegex = "author_regex",
                                DisplayFullContent = true,
                                GetDirectContent = false,
                                ContentParseRegex = "content_parser"
                            };
            var classTwo = new RssItem
                            {
                                Id = id,
                                Url = "test_url",
                                Author = "unknown",
                                Description = "Short_description",
                                Text = "some_text",
                                CreatedDate = DateTime.Now,
                                Modified = DateTime.Now,
                                PublishDate = DateTime.Now
                            };

            using (var tran = RepositoryFactory.StartTransaction())
            {
                SessionFactory<RssFeed>.Store(classOne);

                // here it should fail !!!
                SessionFactory<RssItem>.Store(classTwo);
                tran.Commit();
            }
        }
예제 #3
0
        public virtual void Init()
        {
            TestProvider.SetUp();

            using (var tran = RepositoryFactory.StartTransaction())
            {
                _feed = new RssFeed
                            {
                                Id = Guid.NewGuid(),
                                Name = "feed",
                                Url = "feed_url"
                            };
                TestProvider.Create(_feed);
                _rssItems = new[]
                                {
                                    new RssItem
                                        {
                                            Id = Guid.NewGuid(),
                                            FeedItemId = "1",
                                            Title = "title1",
                                            Text = "Text1",
                                            Description = "Description1",
                                            Author = "twit_user1",
                                            Url = "url1",
                                            Hidden = false,
                                            CreatedDate = new DateTime(2010, 10, 10),
                                            Modified = new DateTime(2010, 10, 10),
                                            PublishDate = new DateTime(2010, 10, 10),
                                            CreatedBy = null,
                                            AreCommentAllowed = false,
                                            RssFeed = _feed
                                        },
                                    new RssItem
                                        {
                                            Id = Guid.NewGuid(),
                                            FeedItemId = "2",
                                            Title = "title2",
                                            Text = "Text2",
                                            Description = "Description2",
                                            Author = "twit_user2",
                                            Url = "url2",
                                            Hidden = false,
                                            CreatedDate = new DateTime(2010, 10, 12),
                                            Modified = new DateTime(2010, 10, 12),
                                            PublishDate = new DateTime(2010, 10, 12),
                                            CreatedBy = null,
                                            AreCommentAllowed = false,
                                            RssFeed = _feed
                                        },
                                    new RssItem
                                        {
                                            Id = Guid.NewGuid(),
                                            FeedItemId = "3",
                                            Title = "title3",
                                            Text = "Text3",
                                            Description = "Description3",
                                            Author = "twit_user3",
                                            Url = "url3",
                                            Hidden = true,
                                            CreatedDate = new DateTime(2010, 10, 13),
                                            Modified = new DateTime(2010, 10, 13),
                                            PublishDate = new DateTime(2010, 10, 13),
                                            CreatedBy = null,
                                            AreCommentAllowed = false,
                                            RssFeed = _feed
                                        }
                                };
                foreach (var rssItem in _rssItems)
                {
                    TestProvider.Create(rssItem);
                }
                tran.Commit();
            }
            TestProvider.WaitForIndexing();
        }
예제 #4
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            DBInit.RegisterIndexes(Store);

            using (var tran = RepositoryFactory.StartTransaction())
            {
                _feed = new RssFeed
                            {
                                Id = Guid.NewGuid(),
                                Name = "feed",
                                Url = "feed_url"
                            };
                SessionFactory<RssFeed>.Store(_feed);
                _rssItems = new[]
                                {
                                    new RssItem
                                        {
                                            Id = Guid.NewGuid(),
                                            FeedItemId = "1",
                                            Title = "title1",
                                            Text = "Text1",
                                            Description = "Description1",
                                            Author = "twit_user1",
                                            Url = "url1",
                                            Hidden = false,
                                            CreatedDate = new DateTime(2010, 10, 10),
                                            Modified = new DateTime(2010, 10, 10),
                                            PublishDate = new DateTime(2010, 10, 10),
                                            CreatedBy = null,
                                            AreCommentAllowed = false,
                                            RssFeed = _feed
                                        },
                                    new RssItem
                                        {
                                            Id = Guid.NewGuid(),
                                            FeedItemId = "2",
                                            Title = "title2",
                                            Text = "Text2",
                                            Description = "Description2",
                                            Author = "twit_user2",
                                            Url = "url2",
                                            Hidden = false,
                                            CreatedDate = new DateTime(2010, 10, 12),
                                            Modified = new DateTime(2010, 10, 12),
                                            PublishDate = new DateTime(2010, 10, 12),
                                            CreatedBy = null,
                                            AreCommentAllowed = false,
                                            RssFeed = _feed
                                        },
                                    new RssItem
                                        {
                                            Id = Guid.NewGuid(),
                                            FeedItemId = "3",
                                            Title = "title3",
                                            Text = "Text3",
                                            Description = "Description3",
                                            Author = "twit_user3",
                                            Url = "url3",
                                            Hidden = true,
                                            CreatedDate = new DateTime(2010, 10, 13),
                                            Modified = new DateTime(2010, 10, 13),
                                            PublishDate = new DateTime(2010, 10, 13),
                                            CreatedBy = null,
                                            AreCommentAllowed = false,
                                            RssFeed = _feed
                                        }
                                };
                foreach (var rssItem in _rssItems)
                {
                    SessionFactory<RssItem>.Store(rssItem);
                }
                tran.Commit();
            }
            WaitForIndexing();
        }