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); }
public TestPessimisticLockingInfo TestSetup(PessimisticLockObject pessimisticLockObject) { var info = new TestPessimisticLockingInfo { PessimisticLockObject = pessimisticLockObject }; return(TestSetupCore(info)); }
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; }
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; }
private static PessimisticLockObject GetPessimisticLockObject(TestPessimisticLockingInfo info) { return info.PessimisticLockObject == null ? info.XPObjectSpace.CreateObject<PessimisticLockObject>() : info.XPObjectSpace.GetObjectByKey<PessimisticLockObject>(info.PessimisticLockObject.Oid); }
public TestPessimisticLockingInfo TestSetup(PessimisticLockObject pessimisticLockObject) { var info = new TestPessimisticLockingInfo { PessimisticLockObject = pessimisticLockObject }; return TestSetupCore(info); }
private static PessimisticLockObject GetPessimisticLockObject(TestPessimisticLockingInfo info) { return(info.PessimisticLockObject == null?info.XPObjectSpace.CreateObject <PessimisticLockObject>() : info.XPObjectSpace.GetObjectByKey <PessimisticLockObject>(info.PessimisticLockObject.Oid)); }