protected override async Task PlatformSetup() { await base.PlatformSetup(); SimpleIoc.Default.Register <IAppNavigationService, AppNavService>(); Configurator.Configure(); }
public void ErrorAfterLambdaExpansionContainsCorrectLineNumbers() { // Given RemoveListener(); Configurator configurator = GetConfigurator(); string configScript = @" Pipelines.Add( Content(true && @doc.Bool(""Key"") == false ) ); foo bar; "; // When ScriptCompilationException exception = null; try { configurator.Configure(configScript); } catch (ScriptCompilationException ex) { exception = ex; } // Then Assert.AreEqual(1, exception.ErrorMessages.Count); StringAssert.StartsWith("Line 8", exception.ErrorMessages[0]); }
public void ErrorContainsCorrectLineNumbers() { // Given RemoveListener(); Configurator configurator = GetConfigurator(); const string configScript = @" int z = 0; foo bar; "; // When ScriptCompilationException exception = null; try { configurator.Configure(configScript); } catch (ScriptCompilationException ex) { exception = ex; } // Then exception.ErrorMessages.Count.ShouldBe(1); exception.ErrorMessages[0].ShouldStartWith("Line 4"); }
public void DoesNotThrowForEquivalentDirectiveValues() { // Given RemoveListener(); Configurator configurator = GetConfigurator(); string configScript = @" #recipe foo #recipe Foo "; // When Exception exception = null; try { configurator.Configure(configScript); } catch (Exception ex) { exception = ex; } // Then Assert.IsNotNull(exception); exception.Message.ShouldNotContain("Directive was previously specified"); }
public void ErrorInDeclarationsWithoutSetupContainsCorrectLineNumbers() { // Given Engine engine = new Engine(); Configurator configurator = new Configurator(engine); string configScript = @" class Y { }; foo bar; --- int z = 0; "; // When AggregateException exception = null; try { configurator.Configure(configScript, false); } catch (AggregateException ex) { exception = ex; } // Then Assert.AreEqual(2, exception.InnerExceptions.Count); StringAssert.StartsWith("Line 4", exception.InnerExceptions[0].Message); StringAssert.StartsWith("Line 4", exception.InnerExceptions[1].Message); }
public void ErrorInConfigWithoutDeclarationsContainsCorrectLineNumbers() { // Given Engine engine = new Engine(); Configurator configurator = new Configurator(engine); string configScript = @" Assemblies.Load(""""); === int z = 0; foo bar; "; // When AggregateException exception = null; try { configurator.Configure(configScript, false); } catch (AggregateException ex) { exception = ex; } // Then Assert.AreEqual(1, exception.InnerExceptions.Count); StringAssert.StartsWith("Line 6", exception.InnerExceptions[0].Message); }
public void ErrorInConfigAfterLambdaExpansionWithArgumentSeparatorNewLinesContainsCorrectLineNumbers() { // Given Engine engine = new Engine(); Configurator configurator = new Configurator(engine); string configScript = @" Assemblies.Load(""""); === Pipelines.Add( If( @doc.Get<bool>(""Key""), Content(""Baz"") ) ); foo bar; "; // When AggregateException exception = null; try { configurator.Configure(configScript, false); } catch (AggregateException ex) { exception = ex; } // Then Assert.AreEqual(1, exception.InnerExceptions.Count); StringAssert.StartsWith("Line 11", exception.InnerExceptions[0].Message); }
static void Main(string[] args) { var configurator = new Configurator(); var exceptionHandler = new ExceptionHandler(); var expressionReader = new JsonExpressionReader(); var algorithmReader = new JsonAlgorithmReader(); var calculator = new Factorizer(); var divider = new GornersDividor(); var writer = new MathMlWriter(); var drawerDataInitializer = new DrawerDataInitializer(); var drawer = new Drawer(); var userAlgorithmStrategyProvider = new UserAlgorithmStrategyProvider(); configurator.Configure(exceptionHandler); var factors = expressionReader.Read(configurator.InputExpressionFile); var algorithm = algorithmReader.Read(configurator.InputAlgorithmExpressionFile); var grephicDataSet = algorithmReader.Read(configurator.InputGraphicDataSetExpressionFile); var decomposed = calculator.Execute(factors, divider, algorithm, userAlgorithmStrategyProvider); writer.Write(decomposed, configurator.OutpuExpressiontFile); var drawerData = drawerDataInitializer.GetDrawerData(grephicDataSet, userAlgorithmStrategyProvider); //var drawerData = drawerDataInitializer.GetDrawerData(factors, start, end, step); drawer.Draw(drawerData); }
public void ThrowsForDuplicateDirectives() { // Given RemoveListener(); Configurator configurator = GetConfigurator(); const string configScript = @" #recipe foo #recipe bar "; // When Exception exception = null; try { configurator.Configure(configScript); } catch (Exception ex) { exception = ex; } // Then Assert.IsNotNull(exception); exception.Message.ShouldContain("Directive was previously specified"); }
public void SetCustomDocumentTypeSetsDocumentFactory() { // Given Engine engine = new Engine(); Configurator configurator = GetConfigurator(engine); string configScript = @" public class MyDocument : CustomDocument { public int Count { get; set; } protected override CustomDocument Clone() { return new MyDocument(); } } --- SetCustomDocumentType<MyDocument>(); "; // When configurator.Configure(configScript); // Then Assert.AreEqual("CustomDocumentFactory`1", engine.DocumentFactory.GetType().Name); }
public void ErrorInConfigAfterLambdaExpansionOnNewLineContainsCorrectLineNumbers() { // Given RemoveListener(); Configurator configurator = GetConfigurator(); string configScript = @" Pipelines.Add( Content( @doc.Get<bool>(""Key"") == false ) ); foo bar; "; // When AggregateException exception = null; try { configurator.Configure(configScript); } catch (AggregateException ex) { exception = ex; } // Then Assert.AreEqual(1, exception.InnerExceptions.Count); StringAssert.StartsWith("Line 8", exception.InnerExceptions[0].Message); }
public void TestSqlConfig() { IConnectionStringValidator csv = new TestCsv(DbType.Sql); IConnectionStringProvider csp = new TestSqlConnectionStringProvider(); Configurator c = new Configurator(csp, csv); c.Configure(_CurrentDirectory); IList <KeyValuePair <String, String> > terms = new List <KeyValuePair <String, String> >(); terms.Add(new KeyValuePair <String, String>(StripBraces(Constants.ConfigTokenNames.DbType), Constants.ConfigTokenValues.DbTypeSql)); // DbType = VFP terms.Add(new KeyValuePair <String, String>(StripBraces(Constants.ConfigTokenNames.DbName), Constants.ConfigTokenValues.DbNameSql)); // DbName = HostDb terms.Add(new KeyValuePair <String, String>(StripBraces(Constants.ConfigTokenValues.DbNameSql), TestConfigurator.SqlServerName)); // Connection element - HosSql & ServerName terms.Add(new KeyValuePair <String, String>(StripBraces(Constants.ConfigTokenValues.DbNameSql), TestConfigurator.SqlDbName)); // Connection element - HosSql & ServerName IEnumerable <String> lines = File.ReadLines(_appConfigFileName).Where(line => !line.Trim().StartsWith("<!--")); foreach (KeyValuePair <String, String> kvp in terms) { IEnumerable <String> selectedLines = lines.Where(line => line.Contains(kvp.Value) && line.Contains(kvp.Key)); Assert.AreEqual(1, selectedLines.Count()); Debug.WriteLine(selectedLines.Take(1).ToList()[0]); } // One line with HostSql SqlServer and SqlDb Assert.AreEqual(1, lines.Where(line => line.Contains(Constants.ConfigTokenValues.DbNameSql) && line.Contains(TestConfigurator.SqlDbName) && line.Contains(TestConfigurator.SqlServerName)).Count() ); }
public static IApplicationBuilder UseWorkflow(this IApplicationBuilder app, IConfigurationRoot configuration) { // WorkflowInit static properties need to be setup before Configurator.Configure since // WorkflowRuntime.ForceInit is called. WorkflowInit.RuleProvider = app.ApplicationServices.GetRequiredService <IWorkflowRuleProvider>(); WorkflowInit.ActionProvider = app.ApplicationServices.GetRequiredService <IWorkflowActionProvider>(); //DWKIT Init Configurator.Configure( (IHttpContextAccessor)app.ApplicationServices.GetService(typeof(IHttpContextAccessor)), (IHubContext <ClientNotificationHub>)app.ApplicationServices.GetService(typeof(IHubContext <ClientNotificationHub>)), configuration); WorkflowRuntime runtime = app.ApplicationServices.GetService(typeof(WorkflowRuntime)) as WorkflowRuntime; var workflowService = app.ApplicationServices.GetService(typeof(WorkflowActivityMonitorService)) as WorkflowActivityMonitorService; workflowService.RegisterEventHandlers(runtime); var CodeActionsDebugOn = GetIntVarOrDefault("DWKIT_CODE_ACTIONS_DEBUG", 0); if (CodeActionsDebugOn > 0) { var temp = GetVarOrDefault("TEMP", "unset"); Log.Information($"DWKIT CodeActionDebugOn: TEMP={temp}"); runtime.CodeActionsDebugOn(); } RecurringJob.AddOrUpdate <WorkflowActivityMonitorService>("WorkflowActivityMonitor", service => service.CheckActivityStatus(), Cron.MinuteInterval(5)); RecurringJob.AddOrUpdate <WorkflowSecuritySyncService>("WorkflowSecuritySync", service => service.SyncWorkflowSecurity(), Cron.MinuteInterval(5)); BackgroundJob.Schedule <WorkflowValidationService>(service => service.validateWorkflows(), TimeSpan.FromSeconds(30)); return(app); }
/// <summary> /// Carrega o arquivo de configuracao. /// </summary> public static void LoadConfiguration() { if (!loadDataConfig) { lock (_loadingObjLock) { if (!loadDataConfig) { #if !PocketPC try { Configurator.Configure(typeof(GDASettings)); } catch (Exception ex) { if (ex is TargetInvocationException) { ex = ex.InnerException; } throw new GDA.Common.Configuration.Exceptions.LoadConfigurationException(ex); } #endif loadDataConfig = true; } } } }
public void ErrorAfterLambdaExpansionWithArgumentSeparatorNewLinesContainsCorrectLineNumbers() { // Given RemoveListener(); Configurator configurator = GetConfigurator(); string configScript = @" Pipelines.Add( If( @doc.Get<bool>(""Key""), Content(""Baz"") ) ); foo bar; "; // When ScriptCompilationException exception = null; try { configurator.Configure(configScript); } catch (ScriptCompilationException ex) { exception = ex; } // Then Assert.AreEqual(1, exception.ErrorMessages.Count); StringAssert.StartsWith("Line 9", exception.ErrorMessages[0]); }
public void ErrorAfterLambdaExpansionOnNewLineContainsCorrectLineNumbers() { // Given RemoveListener(); Configurator configurator = GetConfigurator(); const string configScript = @" Pipelines.Add( Content( @doc.Bool(""Key"") == false ) ); foo bar; "; // When ScriptCompilationException exception = null; try { configurator.Configure(configScript); } catch (ScriptCompilationException ex) { exception = ex; } // Then exception.ErrorMessages.Count.ShouldBe(1); exception.ErrorMessages[0].ShouldStartWith("Line 8"); }
public void ErrorInDeclarationsWithEmptyLinesContainsCorrectLineNumbers() { // Given RemoveListener(); Configurator configurator = GetConfigurator(); string configScript = @" class Y { }; foo bar; --- int z = 0; "; // When AggregateException exception = null; try { configurator.Configure(configScript); } catch (AggregateException ex) { exception = ex; } // Then Assert.AreEqual(2, exception.InnerExceptions.Count); StringAssert.StartsWith("Line 4", exception.InnerExceptions[0].Message); StringAssert.StartsWith("Line 4", exception.InnerExceptions[1].Message); }
public void ErrorContainsCorrectLineNumbers() { // Given RemoveListener(); Configurator configurator = GetConfigurator(); string configScript = @" int z = 0; foo bar; "; // When ScriptCompilationException exception = null; try { configurator.Configure(configScript); } catch (ScriptCompilationException ex) { exception = ex; } // Then Assert.AreEqual(1, exception.ErrorMessages.Count); StringAssert.StartsWith("Line 4", exception.ErrorMessages[0]); }
public void Should_send_request_message_with_no_response_expected() { Configurator.Configure(); _repository.ReplayAll(); GetInvocationHelper().Notify("text"); _channel.AssertWasCalled(ch => ch.Send(Arg <RequestMessage> .Matches(r => !r.IsResponseExpected))); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseCors(Configuration, "CorsSettings"); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } // DEPRECATED. You should uncomment this code if you still continue using old SecurityProvider for some reasons. //app.UseAuthentication(); // UseIdentityServer includes a call to UseAuthentication app.UseIdentityServer(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute("form", "form/{formName}/{*other}", defaults: new { controller = "StarterApplication", action = "Index" }); routes.MapRoute("flow", "flow/{flowName}/{*other}", defaults: new { controller = "StarterApplication", action = "Index" }); routes.MapRoute("account", "account/{action}", defaults: new { controller = "Account", action = "Index" }); routes.MapRoute( name: "default", template: "{controller=StarterApplication}/{action=Index}/"); }); app.UseSignalR(routes => { routes.MapHub <ClientNotificationHub>("/hubs/notifications"); routes.MapHub <AutocompleteHub>(AutocompleteHub.SignalRUrl); }); //app.ApplicationServices.GetRequiredService<CustomCookieAuthenticationEvents>() //DWKIT Init Configurator.Configure(app, Configuration, logger: _loggerFactory.CreateLogger <Startup>()); /* * // DEPRECATED. You should uncomment this code if you still continue using old SecurityProvider for some reasons. * Configurator.Configure( * (IHttpContextAccessor)app.ApplicationServices.GetService(typeof(IHttpContextAccessor)), * (IHubContext<ClientNotificationHub>)app.ApplicationServices.GetService(typeof(IHubContext<ClientNotificationHub>)), * Configuration);*/ #if DEBUG TelemetryConfiguration.Active.DisableTelemetry = true; #endif }
public static void Run() { Client c = Configurator.Configure(true); c.Run(); c = Configurator.Configure(false); c.Run(); }
public void Should_send_message_on_channel() { Configurator.Configure(); bool wasCalled = false; _broadcastChannel.OnSend += m => wasCalled = true; _subject.Create <INotifier>().Notify("test"); Assert.That(wasCalled, Is.True); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public virtual void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceScopeFactory serviceScopeFactory, IServiceProvider serviceProvider) { app.UseAuthentication(); loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseCors("AllowAllOrigins"); GlobalConfiguration.Configuration.UseActivator( new Hangfire.AspNetCore.AspNetCoreJobActivator(serviceScopeFactory)); GlobalJobFilters.Filters.Add( new ErrorReportingJobFilter(serviceProvider.GetService <IClient>())); app.UseHangfireServer(); app.UseHangfireDashboard(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } app.UseStaticFiles(); app.UseMvc(routes => { // View all detected routes routes.MapRouteAnalyzer("/routes"); // Add // DWKit Routes routes.MapRoute("form", "form/{formName}/{*other}", defaults: new { controller = "StarterApplication", action = "Index" }); routes.MapRoute("flow", "flow/{flowName}/{*other}", defaults: new { controller = "StarterApplication", action = "Index" }); routes.MapRoute("account", "account/{action}", defaults: new { controller = "Account", action = "Index" }); // Fallback routes.MapRoute( name: "default", template: "{controller=StarterApplication}/{action=Index}/"); }); app.UseJsonApi(); //DWKIT Init Configurator.Configure( (IHttpContextAccessor)app.ApplicationServices.GetService(typeof(IHttpContextAccessor)), Configuration); }
ICommandLineParser getParser() { Configurator.Configure(); ICommandLineParser parser = Configurator.getImplementation <ICommandLineParser>(); parser.setParameters(); return(parser); }
static void Main(string[] args) { Configurator.Configure(); using (var host = new Host("net://127.0.0.1:3134/CallbackDispatcher")) { host.Start(); Console.WriteLine("Server started...\nPress enter to stop"); Console.ReadLine(); } }
static void Main(string[] args) { Configurator.Configure(); using (var host = new Host("net://127.0.0.1:3135/BroadcastServices")) { host.Start(); Console.WriteLine("Server started...\nPress enter to stop"); Console.ReadLine(); } }
public void SetUp() { Configurator.Configure(); _connectionListener = new LidgrenServerConnectionListener(_applicationId, _listenAddress, _port, new BinaryMessageSerializer(), new UnencryptedCryptoProviderResolver()); _dispatcher = new OperationDispatcher(); _dispatcher.RegisterHandler <ICalculator>(new Calculator()); _dispatcher.RegisterHandler <IGreeter>(new Greeter()); _server = new GenericServerEndpoint(_connectionListener, new ServerConfig(), () => _dispatcher); _server.Start(); }
public WyamConfiguration(Engine engine, Build build) : base(engine) { var configurator = new Configurator(engine); configurator.Recipe = new Wyam.Docs.Docs(); configurator.Theme = "Samson"; configurator.Configure(""); configurator.AssemblyLoader.DirectAssemblies.Add(typeof(HtmlKeys).Assembly); configurator.AssemblyLoader.DirectAssemblies.Add(typeof(WebKeys).Assembly); configurator.AssemblyLoader.DirectAssemblies.Add(typeof(FeedKeys).Assembly); configurator.AssemblyLoader.DirectAssemblies.Add(typeof(CodeAnalysisKeys).Assembly); var assemblyFiles = build.PackageSpecs .SelectMany(x => x.Assemblies) .SelectMany(x => GlobFiles(NukeBuild.TemporaryDirectory / "_packages", x.TrimStart('/', '\\'))) .Distinct() .Select(x => GetRelativePath(NukeBuild.RootDirectory / "input", x)); // Logger.Info(string.Join(", ", assemblyFiles)); Settings[DocsKeys.AssemblyFiles] = assemblyFiles; // Settings[DocsKeys.SolutionFiles] = GlobFiles(NukeBuild.TemporaryDirectory, "**/*.sln") // .Select(x => GetRelativePath(NukeBuild.RootDirectory / "input", x)); Settings[DocsKeys.Title] = "Rocket Surgeons Guild"; Settings[Keys.Host] = "rocketsurgeonsguild.github.io/"; Settings[Keys.LinksUseHttps] = true; // Settings[DocsKeys.SourceFiles] = GetRelativePath(NukeBuild.RootDirectory / "input", NukeBuild.TemporaryDirectory).TrimEnd('/') + "/*/src/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs"; Settings[DocsKeys.IncludeDateInPostPath] = true; Settings[DocsKeys.BaseEditUrl] = "https://github.com/RocketSurgeonsGuild/rocketsurgeonsguild.github.io/blob/dev/input/"; Pipelines.InsertBefore(Docs.Code, "Package", new ReadFiles(NukeBuild.RootDirectory.ToString() + "/packages/*.yml"), new Yaml() ); Pipelines.InsertAfter("Package", "PackageCategories", new GroupByMany((doc, _) => doc.List <string>("Categories"), new Documents("Package") ), new Meta(Keys.WritePath, (doc, _) => new FilePath("packages/" + doc.String(Keys.GroupKey).ToLower().Replace(" ", "-") + "/index.html")), new Meta(Keys.RelativeFilePath, (ctx, _) => ctx.FilePath(Keys.WritePath)), new OrderBy((ctx, _) => ctx.String(Keys.GroupKey)) ); Pipelines.Add("RenderPackage", new Documents("PackageCategories"), new Razor().WithLayout("/_PackageLayout.cshtml"), new WriteFiles() ); }
public void TestParsingRegistrations() { ConfigurationSectionHelper helper = new ConfigurationSectionHelper(); TypeMappingConfigurationElement element = new TypeMappingConfigurationElement(); element.TypeName = "System.Object"; element.MapTo = "RockSolidIoc.Tests.EmptyObject"; TypeMappingCollection collection = new TypeMappingCollection(); collection.Add(element); helper.TypeMappings = collection; Configurator testConfigurator = new Configurator(); IIocContainer result = testConfigurator.Configure(helper); object s = result.Resolve<object>(); Assert.IsInstanceOfType(s, typeof(EmptyObject)); }
public void Configure(ValidatorBuilder <T> builder) { var elementBuilder = new TypeValidatorBuilder <TElement>(); _configurator.Configure(elementBuilder); Validator <TElement> elementValidator = elementBuilder.Build(""); var nestedValidator = new NestedValidator <TElement>(elementValidator); var validator = new EnumerableValidator <T, TElement>(nestedValidator); builder.AddValidator(validator); }
public void Should_send_message_with_method_details() { Configurator.Configure(); _repository.ReplayAll(); const int methodArg = 5; GetInvocationHelper().Hello(methodArg); _channel.AssertWasCalled(ch => ch.Send(Arg <RequestMessage> .Matches(m => m.Args.SequenceEqual(new object[] { methodArg }) && m.MethodName == "Hello" && m.MessageType == _interfaceName))); }
public void TestParsingLifetimeManager() { ConfigurationSectionHelper helper = new ConfigurationSectionHelper(); LifetimeManagerMappingConfigurationElement element = new LifetimeManagerMappingConfigurationElement(); element.LifetimeManagerTypeName = "RockSolidIoc.Tests.MockFriendlyLifetimeManager"; element.TypeName = "System.Object"; LifetimeManagerMappingCollection collection = new LifetimeManagerMappingCollection(); collection.Add(element); helper.LifetimeManagerMappings = collection; Configurator testConfigurator = new Configurator(); IIocContainer result = testConfigurator.Configure(helper); object s = result.Resolve<object>(); MockFriendlyLifetimeManager.Mock.Verify(p => p.AddInstance(It.IsAny<object>()), Times.Exactly(1)); MockFriendlyLifetimeManager.ResetMock(); }
public void TestParsingResolvers() { ConfigurationSectionHelper helper = new ConfigurationSectionHelper(); ResolverConfigurationElement resolver = new ResolverConfigurationElement(); resolver.ResolverTypeName = "RockSolidIoc.Tests.MockFriendlyResolver"; resolver.TypeName = "System.String"; ResolverCollection collection = new ResolverCollection(); collection.Add(resolver); helper.Resolvers = collection; Configurator testConfigurator = new Configurator(); IIocContainer result = testConfigurator.Configure(helper); string s = result.Resolve<string>(); MockFriendlyResolver.Mock.Verify(p => p.ResolveDependency(typeof(string), result), Times.Exactly(1)); MockFriendlyResolver.ResetMock(); }