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));
        }
        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);
  
        }
Beispiel #3
0
 public ProgrammableContext(ProgrammableTestSystem programmableTestSystem) {
     this.programmableTestSystem = programmableTestSystem;
 }
Beispiel #4
0
        public void TestOnPersistingErrorLifecycleMethodPickedUpOn() {
            MethodInfo method = FindMethod(typeof(Customer11), "OnPersistingError", new[] {typeof(Exception)});
            facetFactory.Process(typeof(Customer11), methodRemover, facetHolder);
            IFacet facet = facetHolder.GetFacet(typeof(IOnPersistingErrorCallbackFacet));
            Assert.IsNotNull(facet);
            Assert.IsTrue(facet is OnPersistingErrorCallbackFacetViaMethod);
            var onPersistingErrorCallbackFacetViaMethod = (OnPersistingErrorCallbackFacetViaMethod)facet;
            Assert.AreEqual(method, onPersistingErrorCallbackFacetViaMethod.GetMethod());
            Assert.IsTrue(methodRemover.GetRemoveMethodMethodCalls().Contains(method));

            // and test exception is passed through (assert in Customer11)
            var adapter = new ProgrammableTestSystem().AdapterFor(new Customer11());
            onPersistingErrorCallbackFacetViaMethod.Invoke(adapter, new Exception());
        }
Beispiel #5
0
 public ProgrammableReflector(ProgrammableTestSystem system) {
     this.system = system;
 }