public void If_Active_Difference_Foind_It_Will_Return_Its_Model(){ var store = new XpoModelDictionaryDifferenceStoreFactory<XpoWinModelDictionaryDifferenceStore>().Create( Isolate.Fake.Instance<XafApplication>(), true); Isolate.WhenCalled(() => store.UseModelFromPath()).WillReturn(false); Isolate.WhenCalled(() => store.GetActiveDifferenceObject()).WillReturn(new ModelDifferenceObject(Session.DefaultSession) { Model = DefaultDictionary, PersistentApplication = new PersistentApplication(Session.DefaultSession) }); Isolate.WhenCalled(() => store.SaveDifference(null)).IgnoreCall(); var dictionary = store.LoadDifference(Schema.GetCommonSchema()); Assert.AreEqual(DefaultDictionary.RootNode.ToXml(), dictionary.RootNode.ToXml()); }
public void If_ActiveDifference_Not_Found_It_Will_Save_A_New_Default_Dictionary(){ var store = new XpoModelDictionaryDifferenceStoreFactory<XpoWinModelDictionaryDifferenceStore>().Create( Isolate.Fake.Instance<XafApplication>(), true); Isolate.WhenCalled(() => store.UseModelFromPath()).WillReturn(false); Isolate.WhenCalled(() => store.GetActiveDifferenceObject()).WillReturn(null); var dictionary = store.LoadDifference(Schema.GetCommonSchema()); Assert.AreEqual(new DictionaryNode("Application").ToXml(), dictionary.RootNode.ToXml()); }