예제 #1
0
 public new INakedObjectSpecification LoadSpecification(string name) {
     if (specs.ContainsKey(name)) {
         return specs[name];
     }
     var specification = new TestProxySpecification(name);
     specs[specification.FullName] = specification;
     return specification;
 }
        public virtual void TestValueField() {
            FileVersion.Clock = new TestClock();

            TestProxySpecification type = new TestProxySpecification(typeof (string));
            ObjectData objectData = new ObjectData(type, SerialOid.CreatePersistent(13, typeof(string).FullName), new FileVersion(""));

            Assert.AreEqual(null, objectData.Value("name"));
            objectData.SetField("name", "value");
            Assert.AreEqual("value", objectData.Value("name"));

            IEnumerator<string> e = objectData.Fields();
            Assert.IsTrue(e.MoveNext());
            Assert.IsNotNull(e.Current);
            Assert.IsFalse(e.MoveNext());
        }
        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));
        }