This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm install -g azure-functions-core-tools | |
| // Then open a command prompt in the root directory of your Azure Functions project. The Azure Core Tools requires the host.json file from your project to identify your orchestration instances. | |
| func durable purge-history | |
| // to list all possible actions | |
| // func durable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public async Task<byte[]> GenerateZipFileAsync() | |
| { | |
| using (var memoryStream = new MemoryStream()) | |
| { | |
| using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true)) | |
| { | |
| await AddFileToZipAsync(archive, "HzImpAccountsT.csv", file.Accounts); | |
| await AddFileToZipAsync(archive, "HzImpAcctContactsT.csv", file.Account_Contacts); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private HttpClient CreateAndInitHttpClient(IHttpClientFactory httpClientFactory, WorktribeClientConfig config) | |
| { | |
| if (httpClientFactory == null) | |
| throw new ArgumentNullException(nameof(httpClientFactory)); | |
| if (string.IsNullOrWhiteSpace(config.BaseUrl)) | |
| throw new ArgumentNullException("config.BaseUrl"); | |
| if (string.IsNullOrWhiteSpace(config.Username)) | |
| throw new ArgumentNullException("config.Username"); | |
| if (string.IsNullOrWhiteSpace(config.Password)) | |
| throw new ArgumentNullException("config.Password"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [TestClass] | |
| public class BaseTestWithConfiguration | |
| { | |
| /// <summary> | |
| /// Reads values from local.settings of the main project | |
| /// </summary> | |
| static void ConfigureEnvironmentVariablesFromLocalSettings() | |
| { | |
| var path = Path.GetDirectoryName(typeof(Startup).Assembly.Location); | |
| var json = File.ReadAllText(Path.Join(path, "local.settings.json")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal static IServiceCollection AddConfigOptionsFromConfigSection<T>(this IServiceCollection services, string configSectionName) where T : class | |
| { | |
| services.AddOptions<T>().Configure<IConfiguration>((settings, configuration) => | |
| { | |
| configuration.GetSection(configSectionName).Bind(settings); | |
| }); | |
| return services; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var groupedLines = lines.GroupBy(x => new { x.TRACType, x.Description }) | |
| .Where(z => z.Count() > 1) | |
| .Select(x => x); | |
| foreach (var grp in groupedLines) | |
| { | |
| int idx = 1; | |
| foreach (BudgetLine budgetLine in grp) | |
| { | |
| budgetLine.Description = $"{budgetLine.Description} {idx}"; | |
| idx++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IEnumerable items = (IEnumerable)propertyInfo.GetValue(customerObject, null); | |
| object first = items.Cast<object>().FirstOrDefault(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var baseGenericType = typeof(BaseItemCollection<>); | |
| var genType = tt.GetGenericArguments()[0]; | |
| var specificBaseType = baseGenericType.MakeGenericType(genType); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [FunctionName(nameof(GetIP))] | |
| public async Task<IActionResult> GetIP( | |
| [HttpTrigger(AuthorizationLevel.Function, "get", Route = "check/getIp")] HttpRequest req, ILogger log) | |
| { | |
| log.LogInformation("GetIP called"); | |
| var client = new HttpClient(); | |
| var response = await client.GetAsync(@"https://ifconfig.me"); | |
| return new OkObjectResult(await response.Content.ReadAsStringAsync()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [TestInitialize] | |
| public void BeforeEachTest() | |
| { | |
| using var ftp = CreateRmsSftpService(sftpConfig.ToOptions()); | |
| copiedFilePath = ftp.CopyFile(ftp.TargetFile, $"CPY_{ftp.TargetFile}"); | |
| } | |
| [TestCleanup] | |
| public void AfterEachTest() | |
| { | |
| using var ftp = CreateRmsSftpService(sftpConfig.ToOptions()); |
NewerOlder