protected virtual string RenderCell(object value, ColumnType columnType) { var factory = new PresenterFactory(); var presenter = factory.Instantiate(columnType); return($"{presenter.Execute(value)}"); }
protected virtual void RenderCell(object value, ColumnType columnType, JsonWriter writer) { var factory = new PresenterFactory(); var formatter = factory.Instantiate(columnType); writer.WriteValue(formatter.Execute(value)); }
static void Main(string[] args) { TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; AppDomain.CurrentDomain.UnhandledException += (s, e) => { Console.WriteLine((e.ExceptionObject as Exception).Message); }; var teamcityConfig = new Rest.TeamCity.ConfigurationProvider(); var restClient = new RestClient( teamcityConfig.Host, teamcityConfig.Login, teamcityConfig.Password, MediaType.Json); var tc = new TeamCityApi(restClient); var gateway = new Gateway(new[] { tc }); var presenterFactory = new PresenterFactory(); var output = new Output( presenterFactory, new IOutputStream[] { new ConsoleStream(), new FileStream("log.txt") }); var cancellationSource = new CancellationTokenSource(); output.Write("build bot greetings you"); output.Write("type exit to leave bot"); var client = new TelegramBotClient(new ConfigurationProvider().ApiKey); var commands = new List <CommandBase> { new StartCommand(cancellationSource), new ExitCommand(cancellationSource), new TeamcityGetBuildQueueCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityGetProjectsCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityGetProjectCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityGetBranchesCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityGetBuildsCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityGetBuildTypesCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityGetBuildCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityGetAgentsCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityEnqueueBuild(gateway.For <ITeamCity>(), cancellationSource), new TeamcityGetRunningBuildsCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityEnqueueAgentCommand(gateway.For <ITeamCity>(), cancellationSource), new TeamcityGetBranchCommand(gateway.For <ITeamCity>(), cancellationSource) }; var help = new HelpCommand(commands, cancellationSource); commands.Add(help); var commandsExecutor = new CommandsExecutor(commands); var inputStream = new InputPipeline(); var consoleListener = new ConsoleCommandProducer(inputStream); var runLooper = new RunLooper(inputStream, commandsExecutor, consoleListener, output, cancellationSource); var store = new MemoryStore(); using (var botWrapper = new BotWrapper(client, inputStream, presenterFactory, cancellationSource, commandsExecutor, output, store)) { botWrapper.Start(); runLooper.Run(); } }
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()); }
protected virtual string RenderCell(object value, LookupMatchesViolationData data, ColumnType columnType) { var factory = new PresenterFactory(); var presenter = factory.Instantiate(columnType); return(data.IsEqual ? presenter.Execute(value) : $"{presenter.Execute(value)} <> {presenter.Execute(data.Value)}"); }
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")); } }
//[TestMethod] public void testUpdatePatient() { Mock <IRepositoryFactory> repositoryFactory = new Mock <IRepositoryFactory>(); Mock <IPresenterFactory> presenterFactory = new Mock <IPresenterFactory>(); Mock <IQuestionView> questionView = new Mock <IQuestionView>(); Mock <IGpView> gpView = new Mock <IGpView>(); Patient patient = new Patient(); patient.medicalQuestions = new MedicalQuestions(); Dictionary <string, string> _questions = new Dictionary <string, string>(); _questions.Add("Do you have alergy to latex?", "No"); //questionView.Object.questions = _questions; GPPresenter gPPresenter = new PresenterFactory().getGPPresenter(patient, repositoryFactory.Object, presenterFactory.Object); // mock presenterFactory.Setup(x => x.getGPPresenter(patient, repositoryFactory.Object, presenterFactory.Object)).Returns(gPPresenter); QuestionnairePresenter questionnairePresenter = new QuestionnairePresenter(patient, presenterFactory.Object, repositoryFactory.Object); questionnairePresenter.view = questionView.Object; questionnairePresenter.view.questions = _questions; questionnairePresenter.updatePatient(gpView.Object); }
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)); } } }
protected override void RenderWhenModelIsNull(System.Web.UI.HtmlTextWriter writer) { if (IsEditing || IsPreviewing) { NullModelHelper.RenderNullModelMessage(writer, ViewPath, DataSource, PresenterFactory.GetPresenter <TModel>().GetType(), typeof(TModel)); } }
public void Execute_BooleanColumnObjectValueForFalse_DisplayIsFalse(object value) { var factory = new PresenterFactory(); var presenter = factory.Instantiate(ColumnType.Boolean); var text = presenter.Execute(value); Assert.That(text, Is.EqualTo("False")); }
public void Execute_StringNullValue_NullDisplay(ColumnType columnType) { var factory = new PresenterFactory(); var presenter = factory.Instantiate(columnType); var text = presenter.Execute("(null)"); Assert.That(text, Is.EqualTo("(null)")); }
public void Execute_NumericColumnObjectValue_CorrectDisplay(object value, string expected) { var factory = new PresenterFactory(); var presenter = factory.Instantiate(ColumnType.Numeric); var text = presenter.Execute(value); Assert.That(text, Is.EqualTo(expected)); }
protected override void OnApplicationStarted() { base.OnApplicationStarted(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); PresenterFactory.RegisterPresenters(); }
public void Execute_NumericDecimal_CorrectDisplay() { var factory = new PresenterFactory(); var presenter = factory.Instantiate(ColumnType.Numeric); var text = presenter.Execute(10.400m); Assert.That(text, Is.EqualTo("10.4")); }
public void Execute_TextColumnObjectValueCultureSpecific_CorrectDisplay(object value, string expected, string culture) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(culture); var factory = new PresenterFactory(); var presenter = factory.Instantiate(ColumnType.Text); var text = presenter.Execute(value); Assert.That(text, Is.EqualTo(expected)); }
private static UITouchBlockPresenter CreateTouchBlockPresenter(ICanvas canvas, string touchBlockWindowPrefabPath) { var touchBlockPrefabParams = PrefabGenParamsFactory.Create(canvas, touchBlockWindowPrefabPath); var touchBlockPresenter = PresenterFactory <UITouchBlockPresenter, UITouchBlockWindow> .Create(touchBlockPrefabParams); return(touchBlockPresenter); }
public void TestPresenterFactory() { ITestPresenter presenter = PresenterFactory.Create().GetPresenter <ITestPresenter>(new TestView()); Assert.IsNotNull(presenter); ITestGenericPresentor <Entities.Address> presenter2 = PresenterFactory.Create().GetPresenter <ITestGenericPresentor <Entities.Address> >(new TestView()); Assert.IsNotNull(presenter2); }
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) }; } }
protected TPresenter CreatePresenter <TPresenter, TView>(ICanvas canvas, string prefabPath) where TPresenter : PresenterBase <TView> where TView : ViewBase { var prefabGenParams = PrefabGenParamsFactory.Create(canvas, prefabPath); var presenter = PresenterFactory <TPresenter, TView> .Create(prefabGenParams); _presenters.Add(presenter); return(presenter); }
public void Start <TMainPresenter, TMainView>(IUnityContainer container, PresenterFactory presenterFactory, string viewKey, object input = null) where TMainPresenter : Presenter <TMainView> where TMainView : class, IView { if (!container.IsRegistered(presenterFactory.GetType())) { container.RegisterInstance(presenterFactory); } presenterFactory.Show <TMainPresenter, TMainView>(viewKey, input); }
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); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); RadiantDentalPracticeForm mainView = new RadiantDentalPracticeForm(); IRepositoryFactory repositoryFactory = new RepositoryFactory(); IPresenterFactory presenterFactory = new PresenterFactory(); mainView.radiantDentalPracticePresenter = new RadiantDentalPracticePresenter(presenterFactory, repositoryFactory); Application.Run(mainView); }
protected string GetCompareText(List <ColumnType> columnTypes, DataRow dataRow, int i) { if (string.IsNullOrEmpty(dataRow.GetColumnError(i))) { return(string.Empty); } var factory = new PresenterFactory(); var formatter = factory.Instantiate(columnTypes[i]); return(formatter.Execute(dataRow.GetColumnError(i))); }
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); } }
protected virtual void RenderCell(object value, LookupMatchesViolationData data, ColumnType columnType, JsonWriter writer) { var factory = new PresenterFactory(); var formatter = factory.Instantiate(columnType); writer.WriteStartObject(); writer.WritePropertyName("value"); writer.WriteValue(formatter.Execute(value)); if (!data.IsEqual) { writer.WritePropertyName("expectation"); writer.WriteValue(formatter.Execute(data.Value)); } writer.WriteEndObject(); }
protected string GetText(List <ColumnType> columnTypes, DataRow dataRow, int i) { var factory = new PresenterFactory(); var formatter = factory.Instantiate(columnTypes[i]); var text = string.Empty; if (dataRow.IsNull(i)) { text = formatter.Execute(DBNull.Value); } else { text = formatter.Execute(dataRow.ItemArray[i]); } return(text); }
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 void registerPatientPositiveCase() { Mock <IQuestionView> questionview = new Mock <IQuestionView>(); Mock <IPatientView> view = new Mock <IPatientView>(); IPresenterFactory presenterFactory = new PresenterFactory(); IRepositoryFactory repositoryFactory = new RepositoryFactory(); PatientPresenter patientpresenter = new PatientPresenter( presenterFactory, repositoryFactory); patientpresenter.view = view.Object; patientpresenter.view.city = "newcastle"; patientpresenter.view.country = "UK"; patientpresenter.view.postcode = "ne48as"; patientpresenter.view.email = "*****@*****.**"; patientpresenter.view.name = "priyanka"; patientpresenter.view.phoneNumber = "1234567890"; patientpresenter.view.dob = DateTime.Now; patientpresenter.RegisterPatient(questionview.Object); //patientpresenter.validate(); }
private static void Main() { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var host = Host.CreateDefaultBuilder() .ConfigureServices((services) => { services.AddTransient <IPresenter <MainFormView>, MainFormPresenter <MainFormView> >(); services.AddTransient <IOfficeAppProvider, OfficeAppProvider>(); services.AddSingleton <IMainFormView, MainFormView>(); services.AddSingleton <IProcessWatcher, ProcessWatcher>(); }) .Build(); VaultLocationConfig.ConfigureVault(); PresenterFactory.SetHost(host); var app = ActivatorUtilities.GetServiceOrCreateInstance <MainFormView>(host.Services); Application.Run(app); }
public void SetUp() { kernel = new StandardKernel(new DefaultModule(), new FrameworkDictionaryModule(10)); target = new PresenterFactory(kernel); }
public CompressionView(PresenterFactory presenterFactory) { presenter = presenterFactory.CreateCompressionPresenter(this); }