Beispiel #1
0
        public void MakePersistent_UpdateEntity_Succeed()
        {
            var fakeEntity = CreateFakeEntity();
            var documentSessionProvider = new DocumentSessionProvider(Store);
            var fakeRepository          = new FakeRepository(documentSessionProvider);

            fakeEntity.Name = "Changed";
            fakeRepository.MakePersistent(fakeEntity);
            fakeRepository.SaveChanges();

            using (var session = Store.OpenSession())
            {
                var fakeEntity2 = session.Load <FakeEntity> (fakeEntity.Id);

                Assert.AreEqual("Changed", fakeEntity2.Name);
            }
        }
Beispiel #2
0
        public void MakePersistent_AddNewEntity_Succeed()
        {
            var fakeEntity = new FakeEntity {
                Name = "Fake"
            };
            var documentSessionProvider = new DocumentSessionProvider(Store);
            var fakeRespository         = new FakeRepository(documentSessionProvider);

            fakeRespository.MakePersistent(fakeEntity);
            fakeRespository.SaveChanges();

            using (var session = Store.OpenSession())
            {
                var fakeEntity2 = session.Load <FakeEntity> (fakeEntity.Id);
                Assert.IsNotNull(fakeEntity2);
            }
        }