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

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

            using (mocks.Playback())
            {
                PersistenceService persistenceService = new PersistenceService();
                persistenceService.Create((IList <MyClass>) new List <MyClass>());
            }
        }
Beispiel #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);
        }
        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);
            }
        }
        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);
            }
        }
        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 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);
            }
        }
Beispiel #17
0
 public virtual bool Create(IList<IAlbianObject> userInfo)
 {
     return PersistenceService.Create(userInfo);
 }
        public void ShouldComplainIfNoCreatePersistenceServiceFoundForList()
        {
            using (mocks.Record()) { }

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