예제 #1
0
        private TestPessimisticLockingInfo TestSetupCore(TestPessimisticLockingInfo info)
        {
            var systemModule = new XpandSystemModule();

            // ReSharper disable ConvertClosureToMethodGroup
            Isolate.WhenCalled(() => systemModule.InitializeSequenceGenerator()).IgnoreCall();
            // ReSharper restore ConvertClosureToMethodGroup
            Modules.Add(systemModule);
            Setup("TestApplication", _XPObjectSpaceProvider);
            info.XPObjectSpace = CreateObjectSpace();
            var pessimisticViewController = new PessimisticLockingViewController();

            info.ViewEditModeController = new ViewEditModeController();
            info.PessimisticLockObject  = GetPessimisticLockObject(info);
            info.SecondXPObjectSpace    = CreateObjectSpace();
            var user = info.SecondXPObjectSpace.CreateObject <User>();

            info.SecondXPObjectSpace.CommitChanges();
            Isolate.WhenCalled(() => SecuritySystem.CurrentUser).WillReturn(user);
            Isolate.WhenCalled(() => SecuritySystem.UserType).WillReturn(typeof(User));
            info.XPObjectSpace.CommitChanges();
            info.DetailView = CreateDetailView(info.XPObjectSpace, info.PessimisticLockObject);
            info.Window     = CreateWindow(TemplateContext.View, new List <Controller> {
                pessimisticViewController, info.ViewEditModeController
            }, true);
            info.Window.SetView(info.DetailView);
            return(info);
        }
예제 #2
0
        public TestPessimisticLockingInfo TestSetup(PessimisticLockObject pessimisticLockObject)
        {
            var info = new TestPessimisticLockingInfo {
                PessimisticLockObject = pessimisticLockObject
            };

            return(TestSetupCore(info));
        }
예제 #3
0
파일: Contexts.cs 프로젝트: krazana/eXpand
 private TestPessimisticLockingInfo TestSetupCore(TestPessimisticLockingInfo info) {
     var systemModule = new XpandSystemModule();
     Modules.Add(systemModule);
     Setup("TestApplication", _objectSpaceProvider);
     info.ObjectSpace = CreateObjectSpace();
     var pessimisticViewController = new PessimisticLockingViewController();
     info.ViewEditModeController = new ViewEditModeController();
     info.PessimisticLockObject = GetPessimisticLockObject(info);
     info.SecondObjectSpace = CreateObjectSpace();
     var user = info.SecondObjectSpace.CreateObject<User>();
     info.SecondObjectSpace.CommitChanges();
     Isolate.WhenCalled(() => SecuritySystem.CurrentUser).WillReturn(user);
     Isolate.WhenCalled(() => SecuritySystem.UserType).WillReturn(typeof(User));
     info.ObjectSpace.CommitChanges();
     info.DetailView = CreateDetailView(info.ObjectSpace, info.PessimisticLockObject);
     info.Window = CreateWindow(TemplateContext.View, new List<Controller> { pessimisticViewController, info.ViewEditModeController }, true);
     info.Window.SetView(info.DetailView);
     return info;
 }
예제 #4
0
 private TestPessimisticLockingInfo TestSetupCore(TestPessimisticLockingInfo info) {
     var systemModule = new XpandSystemModule();
     // ReSharper disable ConvertClosureToMethodGroup
     Isolate.WhenCalled(() => systemModule.InitializeSequenceGenerator()).IgnoreCall();
     // ReSharper restore ConvertClosureToMethodGroup
     Modules.Add(systemModule);
     Setup("TestApplication", _XPObjectSpaceProvider);
     info.XPObjectSpace = CreateObjectSpace();
     var pessimisticViewController = new PessimisticLockingViewController();
     info.ViewEditModeController = new ViewEditModeController();
     info.PessimisticLockObject = GetPessimisticLockObject(info);
     info.SecondXPObjectSpace = CreateObjectSpace();
     var user = info.SecondXPObjectSpace.CreateObject<User>();
     info.SecondXPObjectSpace.CommitChanges();
     Isolate.WhenCalled(() => SecuritySystem.CurrentUser).WillReturn(user);
     Isolate.WhenCalled(() => SecuritySystem.UserType).WillReturn(typeof(User));
     info.XPObjectSpace.CommitChanges();
     info.DetailView = CreateDetailView(info.XPObjectSpace, info.PessimisticLockObject);
     info.Window = CreateWindow(TemplateContext.View, new List<Controller> { pessimisticViewController, info.ViewEditModeController }, true);
     info.Window.SetView(info.DetailView);
     return info;
 }
예제 #5
0
 private static PessimisticLockObject GetPessimisticLockObject(TestPessimisticLockingInfo info) {
     return info.PessimisticLockObject == null ? info.XPObjectSpace.CreateObject<PessimisticLockObject>() : info.XPObjectSpace.GetObjectByKey<PessimisticLockObject>(info.PessimisticLockObject.Oid);
 }
예제 #6
0
 public TestPessimisticLockingInfo TestSetup(PessimisticLockObject pessimisticLockObject) {
     var info = new TestPessimisticLockingInfo { PessimisticLockObject = pessimisticLockObject };
     return TestSetupCore(info);
 }
예제 #7
0
 private static PessimisticLockObject GetPessimisticLockObject(TestPessimisticLockingInfo info)
 {
     return(info.PessimisticLockObject == null?info.XPObjectSpace.CreateObject <PessimisticLockObject>() : info.XPObjectSpace.GetObjectByKey <PessimisticLockObject>(info.PessimisticLockObject.Oid));
 }