Esempio n. 1
0
        public void On_CreateCustomModelDiffernceStore_ApplicationConnectionString_Should_Be_Stored(){
            var module = new ModelDifferenceWindowsFormsModule();
            var application = Isolate.Fake.Instance<XafApplication>(Members.CallOriginal);
            application.ConnectionString = "test";
            using (RecorderManager.StartRecording()){
                application.CreateCustomModelDifferenceStore += null;
            }
            module.Setup(application);
            var eventHandle = (EventHandler<CreateCustomModelDifferenceStoreEventArgs>) RecorderManager.LastMockedEvent.GetEventHandle();
            var args = new CreateCustomModelDifferenceStoreEventArgs();

            eventHandle.Invoke(this,args);

            Assert.IsTrue(args.Handled);
//            Assert.AreEqual("test", module.ConnectionString);
        }
        public void Combine_Application_Model_With_ModelDiffs()
        {
            Isolate.Fake.InstanceAndSwapAll<ObjectSpaceProvider>();
            var dictionaryDifferenceStoreFactory = Isolate.Fake.InstanceAndSwapAll<XpoModelDictionaryDifferenceStoreFactory<XpoWinModelDictionaryDifferenceStore>>();
            Isolate.Fake.InstanceAndSwapAll<ConnectionStringDataStoreProvider>();
            Isolate.WhenCalled(() => dictionaryDifferenceStoreFactory.Create(null, false).LoadDifference(null)).WillReturn(elDictionary);
            var module = new ModelDifferenceWindowsFormsModule();
            var application = Isolate.Fake.Instance<XafApplication>();
            Isolate.WhenCalled(() => application.Model).WillReturn(DefaultDictionary);
            using (RecorderManager.StartRecording()){
                application.SetupComplete += null;
            }
            module.Setup(application);
            var handler = (EventHandler<EventArgs>) RecorderManager.LastMockedEvent.GetEventHandle();

            handler.Invoke(this,EventArgs.Empty);

            Assert.AreEqual("el", new ApplicationNodeWrapper(application.Model).BOModel.FindClassByName("MyClass").Caption);
            
        }