コード例 #1
0
 public void Contains_works_correctly()
 {
     var reviews = new HashSet<ReviewTypes> {ReviewTypes.Books, ReviewTypes.Film};
     reviews.Contains(ReviewTypes.Books).ShouldBe(true);
     reviews.Contains(ReviewTypes.Music).ShouldBe(false);
     var user = new User();
     user.UnsubscribeFrom(ReviewTypes.Books);
     user.IsSubscribedTo(ReviewTypes.Books).ShouldBe(false);
 }
コード例 #2
0
        public User CheckUser(string openIdIdentifier)
        {
            var user = _repository.FindOne(u => u.ClaimedIdentifier == openIdIdentifier);
            if (user != null)
                return user;

            user = new User
                       {
                           ClaimedIdentifier = openIdIdentifier,
                           FriendlyIdentifier = openIdIdentifier,
                           Email = openIdIdentifier + "@debug.com",
                           OpenIdProvider = "debug",
                           OpenIdProviderVersion = "1.0"
                       };
            _repository.SaveOrUpdate(user);
            return user;
        }
コード例 #3
0
        public void Can_get_and_insert_live_Content()
        {
            var session = NHibernateSession.GetDefaultSessionFactory().OpenSession();
            new SchemaExport(_configuration).Create(false, true);
            //add the enumerations
            foreach (MusicTypes i in Enumeration.GetAll<MusicTypes>())
            {
                session.Save(i);
            }
            foreach (ReviewTypes i in Enumeration.GetAll<ReviewTypes>())
            {
                session.Save(i);
            }
            //add a user
            var u = new User {ClaimedIdentifier = "test", Email = "*****@*****.**"};
            u.ExcludedReviewTypes.Add(ReviewTypes.Game);
            session.SaveOrUpdate(u);

            //session.Flush();
            var op = new OpenPlatformSearch();

            var fetcher = new ReviewFetcher(op);
            var reviews = fetcher.FetchReviews();
            var repository = new QueryRepository<Review>();
            var nulls = reviews.Where(r => r.ReviewType == null).ToList();
            nulls.Count.ShouldBe(0);

            repository.SaveMany(reviews);
            repository.DbContext.CommitChanges();
        }