Пример #1
0
        public void SetUp()
        {
            // system
            dataManager = new MockDataManager();
            string xmlDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\NakedObjects\testing";

            objectStore       = new XmlObjectStore(dataManager, new DummyServiceManager(), xmlDirectory);
            objectStore.Clock = (new TestClock());

            ProgrammableTestSystem system = new ProgrammableTestSystem();

            Person person = new Person();
            Role   role   = new Role();

            role.Person = person;

            nakedObject = system.AdapterFor(person);
        }
        public override void SetUp()
        {
            base.SetUp();

            // system
            dataManager = new MockDataManager();
            string xmlDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\NakedObjects\xml";

            objectStore       = new XmlObjectStore(dataManager, new DummyServiceManager(), xmlDirectory);
            objectStore.Clock = (new TestClock());

            // objects
            spec = new TestProxySpecification(typeof(string));
            spec.SetupFields(new INakedObjectAssociation[0]);
            nakedObject = new TestProxyNakedObject();
            nakedObject.SetupSpecification(spec);
            nakedObject.OptimisticLock = (new SerialNumberVersion(23, null, null));
        }
        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);
        }
Пример #4
0
 public SaveCommand(INakedObject nakedObject, XmlObjectStore xmlStore)
 {
     this.nakedObject = nakedObject;
     this.xmlStore    = xmlStore;
 }