public void ShouldComplainIfNoCreatePersistenceServiceFound()
        {
            {
                var persistenceService = new PersistenceService();

                Should.Throw <PersistenceMethodNotFoundException>(() => { persistenceService.Create(new MyClass()); });
            }
        }
예제 #2
0
 public void ShouldComplainIfNoCreatePersistenceServiceFoundForList()
 {
     {
         var persistenceService = new PersistenceService();
         Assert.Throws <PersistenceMethodNotFoundException>(
             () => { persistenceService.Create((IList <MyClass>) new List <MyClass>()); });
     }
 }
예제 #3
0
        public void ShouldComplainIfNoCreatePersistenceServiceFoundForList()
        {
            using (mocks.Record()) { }

            using (mocks.Playback())
            {
                PersistenceService persistenceService = new PersistenceService();
                persistenceService.Create((IList <MyClass>) new List <MyClass>());
            }
        }
예제 #4
0
        public void ShouldComplainIfNoCreatePersistenceServiceFound()
        {
            using (mocks.Record()) { }

            using (mocks.Playback())
            {
                PersistenceService persistenceService = new PersistenceService();
                persistenceService.Create(new MyClass());
            }
        }
        public void ShouldReplaceExistingCreatePersister()
        {
            var obj = new MyClass();

            var persistenceService = new PersistenceService();

            persistenceService.SetPersistenceCreateMethod <MyClass>(x => repository.Save(x));
            persistenceService.SetPersistenceCreateMethod <MyClass>(x => repository2.Save(x));
            repository2.Save(obj);
            persistenceService.Create(obj);
        }
예제 #6
0
        public void ShouldComplainIfNoCreatePersistenceServiceFoundForList()
        {
            using (mocks.Record()) { }

            using (mocks.Playback())
            {
                PersistenceService persistenceService = new PersistenceService();
                Assert.Throws <PersistenceMethodNotFoundException>(() =>
                {
                    persistenceService.Create((IList <MyClass>) new List <MyClass>());
                });
            }
        }
        public void ShouldBeAbleToPersistAList_Create()
        {
            IList<MyClass> list = new List<MyClass>();

            PersistenceService persistenceService = new PersistenceService();
            persistenceService.SetPersistenceCreateMethod<IList<MyClass>>(x => repository.SaveAll(x));

            using (mocks.Record())
            {
                repository.Expect(x => x.SaveAll(list));
            }

            using (mocks.Playback())
            {
                persistenceService.Create(list);
            }
        }
        public void ShouldBeAbleToPersistAnObject_Create()
        {
            var obj = new MyClass();

            PersistenceService persistenceService = new PersistenceService();
            persistenceService.SetPersistenceCreateMethod<MyClass>(x => repository.Save(x));

            using (mocks.Record())
            {
                repository.Expect(x => x.Save(obj));
            }

            using (mocks.Playback())
            {
                persistenceService.Create(obj);
            }
        }
        public void ShouldBeAbleToPersistAnObject_Create()
        {
            var obj = new MyClass();

            var persistenceService = new PersistenceService();

            persistenceService.SetPersistenceCreateMethod <MyClass>(x => repository.Save(x));


            {
                repository.Save(obj);
            }


            {
                persistenceService.Create(obj);
            }
        }
예제 #10
0
        public void ShouldBeAbleToPersistAList_Create()
        {
            IList <MyClass> list = new List <MyClass>();

            var persistenceService = new PersistenceService();

            persistenceService.SetPersistenceCreateMethod <IList <MyClass> >(x => repository.SaveAll(x));


            {
                repository.SaveAll(list);
            }


            {
                persistenceService.Create(list);
            }
        }
예제 #11
0
        public void ShouldBeAbleToPersistAList_Create()
        {
            IList <MyClass> list = new List <MyClass>();

            PersistenceService persistenceService = new PersistenceService();

            persistenceService.SetPersistenceCreateMethod <IList <MyClass> >(x => repository.SaveAll(x));

            using (mocks.Record())
            {
                repository.Expect(x => x.SaveAll(list));
            }

            using (mocks.Playback())
            {
                persistenceService.Create(list);
            }
        }
예제 #12
0
        public void ShouldBeAbleToPersistAnObject_Create()
        {
            var obj = new MyClass();

            PersistenceService persistenceService = new PersistenceService();

            persistenceService.SetPersistenceCreateMethod <MyClass>(x => repository.Save(x));

            using (mocks.Record())
            {
                repository.Expect(x => x.Save(obj));
            }

            using (mocks.Playback())
            {
                persistenceService.Create(obj);
            }
        }
예제 #13
0
        public void ShouldReplaceExistingCreatePersister()
        {
            var obj = new MyClass();

            PersistenceService persistenceService = new PersistenceService();

            persistenceService.SetPersistenceCreateMethod <MyClass>(x => repository.Save(x));
            persistenceService.SetPersistenceCreateMethod <MyClass>(x => repository2.Save(x));

            using (mocks.Record())
            {
                repository2.Expect(x => x.Save(obj));
            }

            using (mocks.Playback())
            {
                persistenceService.Create(obj);
            }
        }
        public void ShouldComplainIfNoCreatePersistenceServiceFoundForList()
        {
            using (mocks.Record()) { }

            using (mocks.Playback())
            {
                PersistenceService persistenceService = new PersistenceService();
                persistenceService.Create((IList<MyClass>)new List<MyClass>());
            }
        }
        public void ShouldComplainIfNoCreatePersistenceServiceFound()
        {
            using (mocks.Record()) { }

            using (mocks.Playback())
            {
                PersistenceService persistenceService = new PersistenceService();
                persistenceService.Create(new MyClass());
            }
        }
        public void ShouldReplaceExistingCreatePersister()
        {
            var obj = new MyClass();

            PersistenceService persistenceService = new PersistenceService();
            persistenceService.SetPersistenceCreateMethod<MyClass>(x => repository.Save(x));
            persistenceService.SetPersistenceCreateMethod<MyClass>(x => repository2.Save(x));

            using (mocks.Record())
            {
                repository2.Expect(x => x.Save(obj));
            }

            using (mocks.Playback())
            {
                persistenceService.Create(obj);
            }
        }
예제 #17
0
 public virtual bool Create(IList<IAlbianObject> userInfo)
 {
     return PersistenceService.Create(userInfo);
 }
예제 #18
0
        public void ShouldComplainIfNoCreatePersistenceServiceFoundForList()
        {
            using (mocks.Record()) { }

            using (mocks.Playback())
            {
                PersistenceService persistenceService = new PersistenceService();
                Assert.Throws<PersistenceMethodNotFoundException>(() =>
                {
                    persistenceService.Create((IList<MyClass>)new List<MyClass>());
                });
            }
        }