static void Main(string[] args) { JobHostConfiguration config = new JobHostConfiguration(); config.Tracing.ConsoleLevel = TraceLevel.Verbose; // Set to a short polling interval to facilitate local // debugging. You wouldn't want to run prod this way. config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(2); FilesConfiguration filesConfig = new FilesConfiguration(); if (string.IsNullOrEmpty(filesConfig.RootPath)) { // when running locally, set this to a valid directory filesConfig.RootPath = @"c:\temp\files"; } ; EnsureSampleDirectoriesExist(filesConfig.RootPath); config.UseFiles(filesConfig); config.UseTimers(); config.UseSample(); config.UseCore(); JobHost host = new JobHost(config); host.Call(typeof(FileSamples).GetMethod("ReadWrite")); host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream")); host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString")); host.Call(typeof(TableSamples).GetMethod("CustomBinding")); host.RunAndBlock(); }
public void Test(JobHost <ConfigStream> host) { foreach (var funcName in new string[] { "StreamRead", "StringRead", "ByteArrayRead", "TextReaderRead" }) { _log = null; host.Call(funcName, new { k = 1 }); Assert.Equal("Hello", _log); } // Test writes. Verify the stream content. foreach (var funcName in new string[] { "WriteStream", "WriteStream2", "WriteTextWriter1", "WriteTextWriter2", "WriteTextWriter3", "WriteString", "WriteByteArray" }) { _writeStream = null; host.Call(funcName, new { k = funcName }); var content = _writeStream.ToArray(); // safe to call even after Dispose() var str = Encoding.UTF8.GetString(content); // The comparison will also verify there is no BOM written. Assert.Equal(_writeMessage, str); } }
public static void Main(string[] args) { JobHostConfiguration config = new JobHostConfiguration(); FilesConfiguration filesConfig = new FilesConfiguration(); // See https://github.com/Azure/azure-webjobs-sdk/wiki/Running-Locally for details // on how to set up your local environment if (config.IsDevelopment) { config.UseDevelopmentSettings(); filesConfig.RootPath = @"c:\temp\files"; } config.UseFiles(filesConfig); config.UseTimers(); config.UseSample(); config.UseEasyTables(); config.UseCore(); config.UseDocumentDB(); config.UseNotificationHubs(); var sendGridConfiguration = new SendGridConfiguration() { ToAddress = "*****@*****.**", FromAddress = new MailAddress("*****@*****.**", "WebJobs Extensions Samples") }; config.UseSendGrid(sendGridConfiguration); ConfigureTraceMonitor(config, sendGridConfiguration); EnsureSampleDirectoriesExist(filesConfig.RootPath); WebHooksConfiguration webHooksConfig = new WebHooksConfiguration(); webHooksConfig.UseReceiver <GitHubWebHookReceiver>(); config.UseWebHooks(webHooksConfig); JobHost host = new JobHost(config); // Add or remove types from this list to choose which functions will // be indexed by the JobHost. config.TypeLocator = new SamplesTypeLocator( typeof(ErrorMonitoringSamples), typeof(FileSamples), typeof(MiscellaneousSamples), typeof(SampleSamples), typeof(SendGridSamples), typeof(TableSamples), typeof(TimerSamples), typeof(WebHookSamples)); host.Call(typeof(MiscellaneousSamples).GetMethod("ExecutionContext")); host.Call(typeof(FileSamples).GetMethod("ReadWrite")); host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream")); host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString")); host.Call(typeof(TableSamples).GetMethod("CustomBinding")); host.RunAndBlock(); }
public void Test(JobHost <ConfigWithConverters> host) { host.Call("Func1", new { k = 1 }); Assert.Equal("GeneralBuilder_AlphaType(1)", _log); host.Call("Func2", new { k = 2 }); Assert.Equal("A2B(GeneralBuilder_AlphaType(2))", _log); }
public void Test(JobHost <ConfigMultipleRules> host) { host.Call("Func", new { k = 1 }); Assert.Equal("AlphaBuilder(1)", _log); host.Call("Func2", new { k = 1 }); Assert.Equal("BetaBuilder(1)", _log); }
static void Main() { var hostConfiguration = new JobHostConfiguration(); var host = new JobHost(hostConfiguration); host.Call(typeof(NServiceBusConfiguration).GetMethod(nameof(NServiceBusConfiguration.Initialize))); host.RunAndBlock(); host.Call(typeof(NServiceBusConfiguration).GetMethod(nameof(NServiceBusConfiguration.Terminate))); }
// Please set the following connection strings in app.config for this WebJob to run: // AzureWebJobsDashboard and AzureWebJobsStorage private static void Main() { var host = new JobHost(); // The following code will invoke a function called ManualTrigger and // pass in data (value in this case) to the function host.Call(typeof(Functions).GetMethod(nameof(Functions.UpdateArticles))); host.Call(typeof(Functions).GetMethod(nameof(Functions.DeleteOldArticles))); host.Call(typeof(Functions).GetMethod(nameof(Functions.UpdateEngagementCount))); }
public void Test(JobHost <ConfigExplicitObjectConverter> host) { // normal case host.Call("Func", new { k = 1 }); Assert.Equal("GeneralBuilder_AlphaType(1)", _log); // use 1st rule with explicit converter host.Call("FuncObject", new { k = 1 }); Assert.Equal("Alpha2Obj(GeneralBuilder_AlphaType(1))", _log); }
public static void Main(string[] args) { JobHostConfiguration config = new JobHostConfiguration(); FilesConfiguration filesConfig = new FilesConfiguration(); // See https://github.com/Azure/azure-webjobs-sdk/wiki/Running-Locally for details // on how to set up your local environment if (config.IsDevelopment) { config.UseDevelopmentSettings(); filesConfig.RootPath = @"c:\temp\files"; } config.UseFiles(filesConfig); config.UseTimers(); config.UseSample(); config.UseMobileApps(); config.UseTwilioSms(); config.UseCore(); config.UseCosmosDB(); var sendGridConfiguration = new SendGridConfiguration() { ToAddress = new EmailAddress("*****@*****.**", "WebJobs Extensions Samples"), FromAddress = new EmailAddress("*****@*****.**", "WebJobs Extensions Samples") }; config.UseSendGrid(sendGridConfiguration); ConfigureTraceMonitor(config, sendGridConfiguration); EnsureSampleDirectoriesExist(filesConfig.RootPath); JobHost host = new JobHost(config); // Add or remove types from this list to choose which functions will // be indexed by the JobHost. // To run some of the other samples included, add their types to this list config.TypeLocator = new SamplesTypeLocator( typeof(ErrorMonitoringSamples), typeof(FileSamples), typeof(MiscellaneousSamples), typeof(SampleSamples), typeof(TableSamples), typeof(TimerSamples)); // Some direct invocations to demonstrate various binding scenarios host.Call(typeof(MiscellaneousSamples).GetMethod("ExecutionContext")); host.Call(typeof(FileSamples).GetMethod("ReadWrite")); host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream")); host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString")); host.Call(typeof(TableSamples).GetMethod("CustomBinding")); host.RunAndBlock(); }
public void Test(JobHost <ConfigTestDefaultToMethodName> host) { host.Call("Func", new { k = 1 }); Assert.NotNull(_log); host.Call("Func2", new { k = 1 }); Assert.Equal("Func2", _log); host.Call("FuncRename", new { k = 1 }); Assert.Equal("newname", _log); }
static void Main(string[] args) { var config = new JobHostConfiguration(); config.DashboardConnectionString = null; // apply config before creating the host. var cloudToDeviceExtension = new IoTHubExtension.Config.IoTCloudToDeviceExtension(); config.AddExtension(cloudToDeviceExtension); var directMethodExtension = new IoTHubExtension.Config.IoTDirectMethodExtension(); config.AddExtension(directMethodExtension); var setDeviceTwinExtension = new IoTHubExtension.Config.IoTSetDeviceTwinExtension(); config.AddExtension(setDeviceTwinExtension); var getDeviceTwinExtension = new IoTHubExtension.Config.IoTGetDeviceTwinExtension(); config.AddExtension(getDeviceTwinExtension); // Debug diagnostics! config.CreateMetadataProvider().DebugDumpGraph(Console.Out); var host = new JobHost(config); //var method = typeof(Functions).GetMethod("Dummy"); //Test some invocations. //var method = typeof(Functions).GetMethod("WriteMessageFromC2D"); //host.Call(method); var method = typeof(Functions).GetMethod("WriteMessageFromC2DArg"); host.Call(method, new { deviceId = "receiverBob" }); //Test some invocations. method = typeof(Functions).GetMethod("DirectInvokeMethod"); host.Call(method, new { deviceId = "receiverAlice" }); //// Test some invocations. method = typeof(Functions).GetMethod("SetDeviceTwin"); host.Call(method, new { deviceId = "receiverBob" }); //// Test some invocations. method = typeof(Functions).GetMethod("GetDeviceTwinTwinObject"); host.Call(method, new { deviceId = "receiverBob", messageId = "123" }); // host.RunAndBlock(); }
public void Test(JobHost <ConfigCustom> host) { host.Call("Read"); Assert.Equal(_log, ReadTag); host.Call("Write"); var content = _writeStream.ToArray(); // safe to call even after Dispose() var str = Encoding.UTF8.GetString(content); Assert.Equal("yya", str); }
public void Test(JobHost <ConfigObjectInheritence> host) { // 1st rule host.Call("FuncDerived", new { k = 1 }); Assert.Equal("GeneralBuilder_AlphaDerivedType(1)", _log); // 1st rule + implicit converter host.Call("Func", new { k = 1 }); Assert.Equal("GeneralBuilder_AlphaDerivedType(1)", _log); // 2nd rule, object isn't matched in an inheritence converter host.Call("FuncObject", new { k = 1 }); Assert.Equal("[obj!]", _log); }
// Please set the following connection strings in app.config for this WebJob to run: // AzureWebJobsDashboard and AzureWebJobsStorage static void Main() { JobHostConfiguration config = new JobHostConfiguration(); config.UseTimers(); var host = new JobHost(config); host.Call(typeof(Functions).GetMethod("ProcessRaces")); host.Call(typeof(Functions).GetMethod("ProcessCompetitors")); // The following code ensures that the WebJob will be running continuously //host.RunAndBlock(); }
public void Test(JobHost <ConfigNotExist> host) { host.Call("Read1"); Assert.Null(_log); host.Call("Read2"); Assert.Null(_log); host.Call("Read3"); Assert.Null(_log); host.Call("Read4"); Assert.Null(_log); }
public void Test(JobHost <ConfigAutoResolve> host) { host.Call("Read", new { x = 456 }); // Convert was never called Assert.Equal("456-123", _log); }
public void JobHost_NoStorage_Succeeds() { using (EnvVarHolder.Set("AzureWebJobsStorage", null)) using (EnvVarHolder.Set("AzureWebJobsDashboard", null)) { JobHostConfiguration config = new JobHostConfiguration() { TypeLocator = new FakeTypeLocator(typeof(BasicTest)) }; Assert.Null(config.InternalStorageConfiguration); // Explicitly disalbe storage. config.HostId = Guid.NewGuid().ToString("n"); config.DashboardConnectionString = null; config.StorageConnectionString = null; var randomValue = Guid.NewGuid().ToString(); StringBuilder sbLoggingCallbacks = new StringBuilder(); var fastLogger = new FastLogger(); config.AddService <IAsyncCollector <FunctionInstanceLogEntry> >(fastLogger); JobHost host = new JobHost(config); // Manually invoked. var method = typeof(BasicTest).GetMethod("Method", BindingFlags.Public | BindingFlags.Static); host.Call(method, new { value = randomValue }); Assert.True(BasicTest.Called); Assert.Equal(2, fastLogger.List.Count); // We should be batching, so flush not called yet. host.Start(); // required to call stop() host.Stop(); // will ensure flush is called. // Verify fast logs Assert.Equal(3, fastLogger.List.Count); var startMsg = fastLogger.List[0]; Assert.Equal("BasicTest.Method", startMsg.FunctionName); Assert.Equal(null, startMsg.EndTime); Assert.NotNull(startMsg.StartTime); var endMsg = fastLogger.List[1]; Assert.Equal(startMsg.FunctionName, endMsg.FunctionName); Assert.Equal(startMsg.StartTime, endMsg.StartTime); Assert.Equal(startMsg.FunctionInstanceId, endMsg.FunctionInstanceId); Assert.NotNull(endMsg.EndTime); // signal completed Assert.True(endMsg.StartTime <= endMsg.EndTime); Assert.Null(endMsg.ErrorDetails); Assert.Null(endMsg.ParentId); Assert.Equal(2, endMsg.Arguments.Count); Assert.True(endMsg.Arguments.ContainsKey("log")); Assert.Equal(randomValue, endMsg.Arguments["value"]); Assert.Equal("val=" + randomValue, endMsg.LogOutput.Trim()); Assert.Same(FastLogger.FlushEntry, fastLogger.List[2]); } }
public void TraceWriter_ForwardsTo_ILogger() { using (JobHost host = new JobHost(CreateConfig())) { var method = typeof(ILoggerFunctions).GetMethod(nameof(ILoggerFunctions.TraceWriterWithILoggerFactory)); host.Call(method); } Assert.Equal(5, _trace.Traces.Count); // The third and fourth traces are from our function var infoLog = _trace.Traces[2]; var errorLog = _trace.Traces[3]; Assert.Equal("This should go to the ILogger", infoLog.Message); Assert.Null(infoLog.Exception); Assert.Equal(3, infoLog.Properties.Count); Assert.Equal("This should go to the ILogger with an Exception!", errorLog.Message); Assert.IsType <InvalidOperationException>(errorLog.Exception); Assert.Equal(3, errorLog.Properties.Count); // Five loggers are the startup, singleton, executor, results, and function loggers Assert.Equal(5, _loggerProvider.CreatedLoggers.Count); var functionLogger = _loggerProvider.CreatedLoggers.Where(l => l.Category == LogCategories.Function).Single(); Assert.Equal(2, functionLogger.LogMessages.Count); var infoMessage = functionLogger.LogMessages[0]; var errorMessage = functionLogger.LogMessages[1]; // These get the {OriginalFormat} property as well as the 3 from TraceWriter Assert.Equal(4, infoMessage.State.Count()); Assert.Equal(4, errorMessage.State.Count()); //TODO: beef these verifications up }
static void Main(string[] args) { JobHost host = new JobHost(); host.Call(typeof(Program).GetMethod("WriteFile")); //host.RunAndBlock(); }
private async Task VerifyInputBinding(JobHost host, MethodInfo method) { string data = Guid.NewGuid().ToString(); string inputFileName = ImportTestPath + "/" + string.Format("{0}.txt", method.Name); var inputFile = await _rootFolder.GetFileReferenceAsync(inputFileName, true); await inputFile.WriteAsync(Encoding.UTF8.GetBytes(data)); host.Call(method); string outputFileName = OutputTestPath + "/" + string.Format("{0}.txt", method.Name); var outputFile = await _rootFolder.GetFileReferenceAsync(outputFileName, true); await TestHelpers.Await(() => { return(_rootFolder.FileExists(outputFileName)); }); var result = string.Empty; await TestHelpers.Await(() => { // sometime there is a delay between a file being created in a SAAS provider and its content being non-empty. hence adding this logic. result = Encoding.UTF8.GetString(outputFile.ReadAsync().GetAwaiter().GetResult()); return(!string.IsNullOrEmpty(result)); }); Assert.Equal(data, result); }
public async Task ManualBindToString() { JobHost host = CreateTestJobHost(); var method = typeof(ApiHubTestJobs).GetMethod("BindToStringOutput"); string data = Guid.NewGuid().ToString(); string inputFileName = ImportTestPath + "/BindToString.txt"; var inputFile = await _rootFolder.GetFileReferenceAsync(inputFileName, true); await inputFile.WriteAsync(Encoding.UTF8.GetBytes(data)); host.Call(method, new { input = inputFileName }); string outputFileName = OutputTestPath + "/BindToString.txt"; var outputFile = await _rootFolder.GetFileReferenceAsync(outputFileName, true); await TestHelpers.Await(() => { return(_rootFolder.FileExists(outputFileName)); }); var result = string.Empty; await TestHelpers.Await(() => { // sometime there is a delay between a file being created in a SAAS provider and its content being non-empty. hence adding this logic. result = Encoding.UTF8.GetString(outputFile.ReadAsync().GetAwaiter().GetResult()); return(!string.IsNullOrEmpty(result)); }); Assert.Equal(data, result); }
// Please set the following connection strings in app.config for this WebJob to run: // AzureWebJobsDashboard and AzureWebJobsStorage static void Main() { // The following code will invoke a function called VerifyDocLib var host = new JobHost(); host.Call(typeof(Functions).GetMethod("VerifyDocLib")); }
public void DisabledAggregator_NoAggregator() { // Add the loggerfactory but disable the aggregator var config = CreateConfig(); config.Aggregator.IsEnabled = false; // Ensure the aggregator is never configured by registering an // AggregatorFactory that with a strict, unconfigured mock. var mockFactory = new Mock <IFunctionResultAggregatorFactory>(MockBehavior.Strict); config.AddService <IFunctionResultAggregatorFactory>(mockFactory.Object); using (JobHost host = new JobHost(config)) { // also start and stop the host to ensure nothing throws due to the // null aggregator host.Start(); var method = typeof(ILoggerFunctions).GetMethod(nameof(ILoggerFunctions.TraceWriterWithILoggerFactory)); host.Call(method); host.Stop(); } }
public async Task SystemParameterBindingOutput_GeneratesExpectedBlobs() { JobHost host = new JobHost(_hostConfig); var blobClient = _fixture.StorageAccount.CreateCloudBlobClient(); var container = blobClient.GetContainerReference("test-output"); if (await container.ExistsAsync()) { foreach (CloudBlockBlob blob in (await container.ListBlobsSegmentedAsync(null)).Results) { await blob.DeleteAsync(); } } MethodInfo methodInfo = GetType().GetMethod("SystemParameterBindingOutput"); var arguments = new Dictionary <string, object> { { "input", "Test Value" } }; host.Call(methodInfo, arguments); // We expect 3 separate blobs to have been written var blobs = (await container.ListBlobsSegmentedAsync(null)).Results.Cast <CloudBlockBlob>().ToArray(); Assert.Equal(3, blobs.Length); foreach (var blob in blobs) { string content = await blob.DownloadTextAsync(); Assert.Equal("Test Value", content.Trim(new char[] { '\uFEFF', '\u200B' })); } }
private static void Main() { var host = new JobHost(); host.Call(typeof(Program).GetMethod("Start")); host.RunAndBlock(); }
static void Main(string[] args) { JobHost host = new JobHost(); var methodInfo = typeof(Program).GetMethod("CheckSitesFunction"); host.Call(methodInfo); }
public int Main(string[] args) { var builder = new ConfigurationBuilder(); builder.Add(new JsonConfigurationSource("config.json")); var config = builder.Build(); var webjobsConnectionString = config.Get("Data:AzureWebJobsStorage:ConnectionString"); var dbConnectionString = config.Get("Data:DefaultConnection:ConnectionString"); if (string.IsNullOrWhiteSpace(webjobsConnectionString)) { Console.WriteLine("The configuration value for Azure Web Jobs Connection String is missing."); return(10); } if (string.IsNullOrWhiteSpace(dbConnectionString)) { Console.WriteLine("The configuration value for Database Connection String is missing."); return(10); } var jobHostConfig = new JobHostConfiguration(Configuration.Get("Data:AzureWebJobsStorage:ConnectionString")); var host = new JobHost(jobHostConfig); var methodInfo = typeof(Functions).GetMethods().First(); host.Call(methodInfo); return(0); }
public void ILogger_Succeeds() { using (JobHost host = new JobHost(CreateConfig())) { var method = typeof(ILoggerFunctions).GetMethod(nameof(ILoggerFunctions.ILogger)); host.Call(method); } // Five loggers are the startup, singleton, executor, results, and function loggers Assert.Equal(5, _loggerProvider.CreatedLoggers.Count); var functionLogger = _loggerProvider.CreatedLoggers.Where(l => l.Category == LogCategories.Function).Single(); var resultsLogger = _loggerProvider.CreatedLoggers.Where(l => l.Category == LogCategories.Results).Single(); Assert.Equal(2, functionLogger.LogMessages.Count); var infoMessage = functionLogger.LogMessages[0]; var errorMessage = functionLogger.LogMessages[1]; // These get the {OriginalFormat} property as well as the 3 from TraceWriter Assert.Equal(3, infoMessage.State.Count()); Assert.Equal(3, errorMessage.State.Count()); Assert.Equal(1, resultsLogger.LogMessages.Count); //TODO: beef these verifications up }
public void TraceWriter_ForwardsTo_ILogger() { string functionName = nameof(ILoggerFunctions.TraceWriterWithILoggerFactory); using (JobHost host = new JobHost(CreateConfig())) { var method = typeof(ILoggerFunctions).GetMethod(functionName); host.Call(method); } // Five loggers are the startup, singleton, results, function and function.user Assert.Equal(5, _loggerProvider.CreatedLoggers.Count()); var functionLogger = _loggerProvider.CreatedLoggers.Where(l => l.Category == LogCategories.CreateFunctionUserCategory(functionName)).Single(); var messages = functionLogger.GetLogMessages(); Assert.Equal(2, messages.Count); var infoMessage = messages[0]; var errorMessage = messages[1]; // These get the {OriginalFormat} only Assert.Single(infoMessage.State); Assert.Single(errorMessage.State); //TODO: beef these verifications up }
public void ILogger_Succeeds() { string functionName = nameof(ILoggerFunctions.ILogger); using (JobHost host = new JobHost(CreateConfig())) { var method = typeof(ILoggerFunctions).GetMethod(functionName); host.Call(method); } // Six loggers are the startup, singleton, results, function and function.user Assert.Equal(5, _loggerProvider.CreatedLoggers.Count()); var functionLogger = _loggerProvider.CreatedLoggers.Where(l => l.Category == LogCategories.CreateFunctionUserCategory(functionName)).Single(); var resultsLogger = _loggerProvider.CreatedLoggers.Where(l => l.Category == LogCategories.Results).Single(); var messages = functionLogger.GetLogMessages(); Assert.Equal(2, messages.Count); var infoMessage = messages[0]; var errorMessage = messages[1]; // These get the {OriginalFormat} property as well as the 2 from structured log properties Assert.Equal(3, infoMessage.State.Count()); Assert.Equal(3, errorMessage.State.Count()); Assert.Equal(1, resultsLogger.GetLogMessages().Count); // TODO: beef these verifications up }
public static void Main() { // See the AzureJobsData and AzureJobsRuntime in the app.config var host = new JobHost(); var m = typeof(Program).GetMethod("AggregateRss"); host.Call(m); Console.WriteLine(" aggregated to:"); Console.WriteLine("https://{0}.blob.core.windows.net/blog/output.rss.xml", host.UserAccountName); }
public void CanBindExecutionContext() { JobHostConfiguration config = new JobHostConfiguration { TypeLocator = new ExplicitTypeLocator(typeof(CoreTestJobs)) }; config.UseCore(); JobHost host = new JobHost(config); host.Call(typeof(CoreTestJobs).GetMethod("ExecutionContext")); ExecutionContext result = CoreTestJobs.Context; Assert.NotNull(result); Assert.NotEqual(Guid.Empty, result.InvocationId); }
static int Main(string[] args) { var options = new Options(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { if (0 == String.Compare(options.JobType, "azure", StringComparison.CurrentCultureIgnoreCase)) { Debug.WriteLine("Running in Azure WebJob mode"); var host = new JobHost(); host.Call(typeof(Program).GetMethod("SyncBranchResourceFiles")); } else { Debug.WriteLine("Running in local mode"); SyncBranchResourceFiles(); } return 0; } return 2; }
private static void RunWebJobsSDKTestInternal(bool disableLogging) { JobHostConfiguration hostConfig = new JobHostConfiguration(_connectionString); hostConfig.NameResolver = _nameResolver; hostConfig.TypeLocator = new FakeTypeLocator(typeof(BlobOverheadPerfTest)); if (disableLogging) { hostConfig.DashboardConnectionString = null; } JobHost host = new JobHost(hostConfig); host.Call(typeof(BlobOverheadPerfTest).GetMethod("BlobToBlob")); }
private async Task VerifyInputBinding(JobHost host, MethodInfo method) { string data = Guid.NewGuid().ToString(); string inputFile = Path.Combine(rootPath, ImportTestPath, string.Format("{0}.txt", method.Name)); File.WriteAllText(inputFile, data); host.Call(method); string outputFile = Path.Combine(rootPath, OutputTestPath, string.Format("{0}.txt", method.Name)); await TestHelpers.Await(() => { return File.Exists(outputFile); }); // give time for file to close await Task.Delay(1000); string result = File.ReadAllText(outputFile); Assert.Equal(data, result); }
private void PrepareHostForTrigger(JobHost host, bool startHost) { host.Call(typeof(AsyncCancellationEndToEndTests).GetMethod("WriteQueueMessage")); if (startHost) { host.Start(); Assert.True(_functionStarted.WaitOne(DefaultTimeout)); } }
public static void Main() { JobHost jobHost = new JobHost(); jobHost.Call(typeof(Cleanup).GetMethod("CleanupFunction")); }
static void Main() { CreateDemoData(); JobHost host = new JobHost(); host.Call(typeof(Program).GetMethod("ManualTrigger")); host.RunAndBlock(); }