public void ShouldBeAbleToSetCreatePersistenceMethod()
        {
            Action <MyClass> func = x => repository.Save(x);

            builderSettings.SetCreatePersistenceMethod <MyClass>(func);

            persistenceService.Received().SetPersistenceCreateMethod(func);
        }
Beispiel #2
0
        public void ShouldBeAbleToSetCreatePersistenceMethod()
        {
            Action <MyClass> func = x => repository.Save(x);

            using (mocks.Record())
            {
                persistenceService.Expect(x => x.SetPersistenceCreateMethod(func));
            }

            builderSetup.SetCreatePersistenceMethod <MyClass>(func);
        }
        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 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 ShouldBeAbleToPersistAnObject_Create()
        {
            var obj = new MyClass();

            var persistenceService = new PersistenceService();

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


            {
                repository.Save(obj);
            }


            {
                persistenceService.Create(obj);
            }
        }