public void SetUp() {
            system = new ProgrammableTestSystem();
        
            Person person = new Person();
            Role role = new Role();
            role.Person = person;

            personAdapter = system.AdapterFor(person);
            roleAdapter = system.AdapterFor(role);

            adder = new PersistedObjectAdderSpy();
            algorithm = new DefaultPersistAlgorithm();

            Assert.IsFalse(roleAdapter.ResolveState.IsResolved());
            Assert.That(adder.PersistedObjects.Count, Is.EqualTo(0));

            roleAdapter.Specification.AddFacet(new PersistingCallbackFacetNull(roleAdapter.Specification));
            roleAdapter.Specification.AddFacet(new PersistedCallbackFacetNull(roleAdapter.Specification));
            roleAdapter.Specification.AddFacet(new LoadingCallbackFacetNull(roleAdapter.Specification));
            roleAdapter.Specification.AddFacet(new LoadedCallbackFacetNull(roleAdapter.Specification));
            personAdapter.Specification.AddFacet(new PersistingCallbackFacetNull(personAdapter.Specification));
            personAdapter.Specification.AddFacet(new PersistedCallbackFacetNull(personAdapter.Specification));
            personAdapter.Specification.AddFacet(new LoadingCallbackFacetNull(personAdapter.Specification));
            personAdapter.Specification.AddFacet(new LoadedCallbackFacetNull(personAdapter.Specification));
        }
Пример #2
0
        public void SetUp()
        {
            mockPersistor = new Mock <IObjectPersistor>();
            persistor     = mockPersistor.Object;

            mockManager = new Mock <INakedObjectManager>();
            manager     = mockManager.Object;

            algorithm = new DefaultPersistAlgorithm(persistor, manager);
        }
        public override INakedObjectPersistor CreateObjectPersistor()
        {
            Log.Info("installing " + GetType().FullName);

            if (objectStore == null)
            {
                objectStore = new XmlObjectStore {
                    Clock        = new DefaultClock(),
                    XmlDirectory = XmlDirectory
                };
            }

            var persistAlgorithm = new DefaultPersistAlgorithm();
            var persistor        = new ObjectStorePersistor {
                ObjectStore      = objectStore,
                PersistAlgorithm = persistAlgorithm,
                OidGenerator     = new TimeBasedOidGenerator(),
                IdentityMap      = new IdentityMapImpl {
                    IdentityAdapterMap = identityAdapterMap, PocoAdapterMap = pocoAdapterMap
                }
            };

            return(persistor);
        }