예제 #1
0
        public void Can_Store_And_Retrieve_A_Simple_Instance()
        {
            const string id = "Hope";
            using (var session = DocumentStore.OpenSession())
            {

                var dummy = new Dummy
                                {CreationTime = DateTime.Now, Id = id, NumberOfCrash = 17};
                session.Store(dummy);
                session.SaveChanges();
            }

            using (var session = DocumentStore.OpenSession())
            {
                var dummy = session.Load<Dummy>(id);
                Assert.That(dummy,Is.Not.Null);
            }
        }
예제 #2
0
        public void Nothing_Is_Stored_If_SaveChanges_Is_Not_Called()
        {
            const string id = "NotStored";
            using (var session = DocumentStore.OpenSession())
            {

                var dummy = new Dummy { CreationTime = DateTime.Now, Id = id, NumberOfCrash = 17 };
                session.Store(dummy);
            }

            using (var session = DocumentStore.OpenSession())
            {
                var dummy = session.Load<Dummy>(id);
                Assert.That(dummy, Is.Null);
            }
        }
예제 #3
0
        public void You_can_change_an_existing_document()
        {
            var id = Guid.NewGuid();
            using (var session = DocumentStore.OpenSession())
            {

                var dummy = new Dummy { CreationTime = DateTime.Now, Id = "NotStored", NumberOfCrash = 17 };
                session.Store(dummy);
            }

            using (var session = DocumentStore.OpenSession())
            {
                var dummy = session.Load<Dummy>(id);
                Assert.That(dummy, Is.Null);
            }
        }