Пример #1
0
            public static void CreateTestData(IDocumentStore docStore)
            {
                using (var session = docStore.OpenSession())
                {
                    var period = new Period("Periods/1", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 1");
                    session.Store(period);
                    var period2 = new Period("Periods/2", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 2");
                    session.Store(period2);

                    var period2_1 = new Period2("Period2s/1", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 1");
                    session.Store(period2_1);
                    var period2_2 = new Period2("Period2s/2", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 2");
                    session.Store(period2_2);
                    session.SaveChanges();
                }
            }
Пример #2
0
            public static void CreateTestData(IDocumentStore docStore)
            {
                using (var session = docStore.OpenSession())
                {
                    var period = new Period("Periods/1", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 1");
                    session.Store(period);
                    var period2 = new Period("Periods/2", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 2");
                    session.Store(period2);

                    var period2_1 = new Period2("Period2s/1", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 1");
                    session.Store(period2_1);
                    var period2_2 = new Period2("Period2s/2", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 2");
                    session.Store(period2_2);
                    session.SaveChanges();
                }
            }
Пример #3
0
        public void CanPersistAndLoad_WORKS2()
        {
            using (var session = _docStore.OpenSession())
            {
                var period2_1 = new Period2("Period2s/1", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 1");
                session.Store(period2_1);
                var period2_2 = new Period2("Period2s/2", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 2");
                session.Store(period2_2);
                session.SaveChanges();

                // These loads will be served from the session
                var loadedPeriod1 = session.Load <Period2>("Period2s/1");
                var loadedPeriod2 = session.Load <Period2>("Period2s/2");

                // So these tests work
                Assert.Equal("State 1", loadedPeriod1.State);
                Assert.Equal("State 2", loadedPeriod2.State);
            }
        }
Пример #4
0
        public void CanPersistAndLoad_WORKS2()
        {
            using (var session = _docStore.OpenSession())
            {
                var period2_1 = new Period2("Period2s/1", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 1");
                session.Store(period2_1);
                var period2_2 = new Period2("Period2s/2", DateTime.Parse("2012-11-11T23:00:00"), DateTime.Parse("2012-11-11T23:59:59"), "State 2");
                session.Store(period2_2);
                session.SaveChanges();

                // These loads will be served from the session
                var loadedPeriod1 = session.Load<Period2>("Period2s/1");
                var loadedPeriod2 = session.Load<Period2>("Period2s/2");

                // So these tests work
                Assert.Equal("State 1", loadedPeriod1.State);
                Assert.Equal("State 2", loadedPeriod2.State);
            }
        }