public void CurrentObjectModel_Should_Be_Equal_CurrentObject_PersistentApp_Not_Modified_Cloned_Combined_With_Controller_Diffs(){

            string s = "<Application><BOModel><Class Name=\"MyClass2\" Caption=\"el\"></Class></BOModel></Application>";
            var modelEditorPropertyEditor = new ModelEditorPropertyEditor(null, null);
            Isolate.WhenCalled(() => modelEditorPropertyEditor.Control.Controller.IsModified).WillReturn(true);
            var modelDifferenceObject = new ModelDifferenceObject(Session.DefaultSession);
            Isolate.WhenCalled(() => modelEditorPropertyEditor.CurrentObject).WillReturn(modelDifferenceObject);
            Isolate.WhenCalled(() => modelDifferenceObject.PersistentApplication.Model.Clone()).WillReturn(DefaultDictionary2);
            Isolate.WhenCalled(() => modelEditorPropertyEditor.Control.Controller.Dictionary.GetDiffs()).WillReturn(new Dictionary(new DictionaryXmlReader().ReadFromString(s),Schema.GetCommonSchema()));

            modelEditorPropertyEditor.ModifyCurrentObjectModel();
            
            Assert.AreEqual("el", new ApplicationNodeWrapper(modelDifferenceObject.Model).BOModel.FindClassByName("MyClass2").Caption);
        }
        public void When_Current_Node_Attribute_Changed_It_Should_Modify_Object()
        {
            var editor = new ModelEditorPropertyEditor(null, null);
            Isolate.WhenCalled(() => editor.CurrentObject).ReturnRecursiveFake();
            Isolate.WhenCalled(() => editor.CurrentObject.GetCombinedModel()).WillReturn(DefaultDictionary);
            bool modified = false;
            Isolate.WhenCalled(() => editor.ModifyCurrentObjectModel()).DoInstead(context => modified = true);
            var editorController = Isolate.Fake.InstanceAndSwapAll<ModelEditorController>();
            using (RecorderManager.StartRecording()){
                editorController.CurrentAttributeValueChanged += null;
            }
            editor.GetModelEditorController(Isolate.Fake.Instance<XafApplication>());
            var handler = (EventHandler) RecorderManager.LastMockedEvent.GetEventHandle();

            handler.Invoke(this,EventArgs.Empty);

            Assert.IsTrue(modified);

        }