public void PublishAndUnpublishTest() { long layoutId = VirtualLayoutCopierTests.GetFirstlayoutId(); // layoutId = 56295660000000; if (layoutId > 0) { var container = StructureMapContainerInit(); long copiedId = VirtualLayoutCopier.CreateLayoutCopyInAvrService(layoutId, "ru", container); SharedModel model; using (PresenterFactory.BeginSharedPresenterTransaction(container, new EmptyPostableForm())) { model = PresenterFactory.SharedPresenter.SharedModel; } using (var dbService = new WinLayout_DB(model)) { long publishedId; using (new StopwathTransaction("++ Publish layout " + copiedId)) { publishedId = dbService.PublishUnpublish(copiedId, true); } Assert.AreEqual(1, GetLayoutCount(publishedId)); using (new StopwathTransaction("++ UnPublish layout " + publishedId)) { dbService.PublishUnpublish(copiedId, false); } Assert.AreEqual(0, GetLayoutCount(publishedId)); } } }
public void MyTestInitialize() { m_Container = StructureMapContainerInit(); BaseReportTests.InitDBAndLogin(); using (PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm())) { m_LayoutDB = new WinLayout_DB(PresenterFactory.SharedPresenter.SharedModel); } lock (m_LayoutDB.Connection) { OpenConnection(); using (var command = new SqlCommand(GetQueryIdSQL)) { command.Connection = (SqlConnection)m_LayoutDB.Connection; m_TestQueryId = (long)command.ExecuteScalar(); } CloseConnection(); } m_PivotDB = new BaseAvrDbService(); m_LayoutDB.AddLinkedDbService(m_PivotDB, null, RelatedPostOrder.SkipPost); m_ChartDB = new BaseAvrDbService(); m_LayoutDB.AddLinkedDbService(m_ChartDB, null, RelatedPostOrder.SkipPost); LookupManager.AddObject("Query", null, AvrQueryLookup.Accessor.Instance(null).GetType(), "_SelectListInternal"); LookupManager.AddObject("LayoutFolder", null, AvrFolderLookup.Accessor.Instance(null).GetType(), "_SelectListInternal"); LookupManager.AddObject("Layout", null, AvrLayoutLookup.Accessor.Instance(null).GetType(), "_SelectListInternal"); m_PresenterTransaction = PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm()); }
public void ContextKeeperInPresenterTest() { Console.WriteLine(@"ContextKeeperInPresenterTest"); using (PresenterFactory.BeginSharedPresenterTransaction(StructureMapContainerInit(), new BaseForm())) { var mocks = new Mockery(); var mapView = mocks.NewMock <IMapView>(); var layoutDetailView = mocks.NewMock <ILayoutDetailView>(); Expect.Once.On(mapView).EventAdd("SendCommand", Is.Anything); Expect.Once.On(mapView).SetProperty("DBService"); Expect.Once.On(layoutDetailView).EventAdd("SendCommand", Is.Anything); Expect.Once.On(layoutDetailView).SetProperty("DBService"); var presenter1 = PresenterFactory.SharedPresenter[mapView] as MapPresenter; Assert.IsNotNull(presenter1); var presenter2 = PresenterFactory.SharedPresenter[layoutDetailView] as LayoutDetailPresenter; Assert.IsNotNull(presenter2); using (presenter1.SharedPresenter.ContextKeeper.CreateNewContext("ContextName")) { Assert.IsTrue(presenter1.SharedPresenter.ContextKeeper.ContainsContext("ContextName")); Assert.IsTrue(presenter2.SharedPresenter.ContextKeeper.ContainsContext("ContextName")); } Assert.IsFalse(presenter1.SharedPresenter.ContextKeeper.ContainsContext("ContextName")); Assert.IsFalse(presenter2.SharedPresenter.ContextKeeper.ContainsContext("ContextName")); } }
public VirtualChart(IContainer container) { using (PresenterFactory.BeginSharedPresenterTransaction(container, new EmptyPostableForm())) { m_SharedPresenter = PresenterFactory.SharedPresenter; // any size m_ChartDetail = new ChartDetailForm { Size = new Size(1000, 1000) }; } }
public override void MyTestInitialize() { base.MyTestInitialize(); m_PresenterTransaction = PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm()); PresenterFactory.SharedPresenter.SharedModel.ExportStrategy = new FakeExportDialogStrategy(); m_ChartForm = new ChartDetailPanel(); m_ChartPresenter = new ChartPresenter(PresenterFactory.SharedPresenter, m_ChartForm); }
public VirtualPivot(IContainer container) { DevXLocalizer.Init(); m_Container = container; m_PivotPlaceHolder = new VirtualPivotPlaceHolder(); using (PresenterFactory.BeginSharedPresenterTransaction(m_Container, m_PivotPlaceHolder)) { m_SharedPresenter = PresenterFactory.SharedPresenter; m_DBService = new WinLayout_DB(m_SharedPresenter.SharedModel); m_AvrPivot = new AvrPivotGrid(); m_PivotPlaceHolder.Controls.Add(m_AvrPivot); } }
private void InitPresentersAndViews() { using (PresenterFactory.BeginSharedPresenterTransaction(StructureMapContainerInit(), new BaseForm())) { var mocks = new Mockery(); var chartView = DataHelper.GetView <IChartView>(mocks); m_ChartPresenter = DataHelper.GetPresenter <ChartPresenter>(chartView); Assert.IsNotNull(m_ChartPresenter); IPivotDetailView pivotView = PivotPresenterReportTests.GetPivotView(mocks); m_PivotDetailPresenter = DataHelper.GetPresenter <PivotDetailPresenter>(pivotView); Assert.IsNotNull(m_PivotDetailPresenter); var mapView = DataHelper.GetView <IMapView>(mocks); m_MapPresenter = DataHelper.GetPresenter <MapPresenter>(mapView); Assert.IsNotNull(m_MapPresenter); var layoutInfoView = DataHelper.GetView <IPivotInfoDetailView>(mocks); m_PivotInfoPresenter = DataHelper.GetPresenter <PivotInfoPresenter>(layoutInfoView); Assert.IsNotNull(m_PivotInfoPresenter); var viewDetailView = DataHelper.GetView <IViewDetailView>(mocks); m_ViewDetailPresenter = DataHelper.GetPresenter <ViewDetailPresenter>(viewDetailView); Assert.IsNotNull(m_ViewDetailPresenter); var layoutDetailView = DataHelper.GetView <ILayoutDetailView>(mocks); m_LayoutDetailPresenter = DataHelper.GetPresenter <LayoutDetailPresenter>(layoutDetailView); Assert.IsNotNull(m_LayoutDetailPresenter); var pivotGridView = mocks.NewMock <IAvrPivotGridView>(); Expect.Once.On(pivotGridView).EventAdd("SendCommand", Is.Anything); m_PivotGridPresenter = PresenterFactory.SharedPresenter[pivotGridView] as AvrPivotGridPresenter; Assert.IsNotNull(m_PivotGridPresenter); mocks.VerifyAllExpectationsHaveBeenMet(); } }
public void ZlibLayoutTest() { string streamXml; using (PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm())) { using (var pivotGrid = new AvrPivotGrid()) { var dataTable = new AvrDataTable(DataHelper.GenerateTestTable()); pivotGrid.SetDataSourceAndCreateFields(dataTable); streamXml = ViewReportTests.GetLayoutXml(pivotGrid); } } byte[] bytes = BinaryCompressor.ZipString(streamXml); string uncompressed = BinaryCompressor.UnzipString(bytes); Assert.AreEqual(streamXml, uncompressed); }
public override void MyTestInitialize() { base.MyTestInitialize(); m_PresenterTransaction = PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm()); }
public void MyTestInitialize() { m_PresenterTransaction = PresenterFactory.BeginSharedPresenterTransaction(StructureMapContainerInit(), new BaseForm()); }
public void MyTestInitialize() { EIDSS_LookupCacheHelper.Init(); m_PresenterTransaction = PresenterFactory.BeginSharedPresenterTransaction(StructureMapContainerInit(), new BaseForm()); }
public void MyTestInitialize() { EIDSS_LookupCacheHelper.Init(); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); m_PresenterTransaction = PresenterFactory.BeginSharedPresenterTransaction(StructureMapContainerInit(), new BaseForm()); }