Exemple #1
0
        private static void InitTestDb(string ravenUrl)
        {
            DocumentStore = new DocumentStore
                                {
                                    Url = ravenUrl
                                }.Initialize();
            using (var session = DocumentStore.OpenSession())
            {
                if (session.Query<ShowInfoCache>().Count() == 0)
                {
                    var updater = new ShowUpdater(session, x => Logger.Info("Updated names"));
                    updater.UpdateShowNames();
                    session.SaveChanges();
                }
                if (session.Query<User>().Count() == 0)
                {
                    var users = new UserUpdater(session, _ => { });
                    string salt;
                    var pwHash = Passwords.Hash("123456789012", out salt);
                    users.CreateUser("alun", pwHash, salt);
                    session.SaveChanges();
                }

            }
        }
Exemple #2
0
        public void TestFullRun()
        {
            using (var store = new DocumentStore { Url = "http://localhost:8080" }.Initialize())
            {
                IndexCreation.CreateIndexes(typeof(SourceShowInfoCaches_ByName).Assembly, store);

                using (var session = store.OpenSession())
                {
                    var updater = new ShowUpdater(session, x => Console.WriteLine("Updated: " + x));
                    updater.UpdateShowNames();
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new ShowUpdater(session, x => Console.WriteLine("Updated: " + x));
                    updater.UpdateShowNames();
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new ShowUpdater(session, x => Console.WriteLine("Updated: " + x));
                    updater.SeedShow("24496");
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new ShowUpdater(session, x => Console.WriteLine("Updated: " + x));
                    updater.UpdateShows();
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new UserUpdater(session, x => Console.WriteLine("CreateUser: "******"testve", "2342342434234", "2353465346546");
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new UserUpdater(session, x => Console.WriteLine("AddShow: " + x));
                    updater.AddShow("testve", "24496");
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new UserUpdater(session, x => Console.WriteLine("AddShow: " + x));
                    updater.SetEpisodeWatched("testve", "24496");
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new UserUpdater(session, x => Console.WriteLine("AddShow: " + x));
                    updater.SetSeasonWatched("testve", "24496");
                    session.SaveChanges();
                }
            }
        }