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 static class ObservableCollectionExtensions | |
{ | |
/// <summary> | |
/// Synchronizes source collection with the target to get identical lists. | |
/// </summary> | |
/// <param name="source">Collection to modify during synchronization.</param> | |
/// <param name="target">Target collection to receive.</param> | |
/// <param name="comparer">Equality comparer for the items.</param> | |
/// <returns>Returns items that were removed from the <paramref name="source"/> collection to properly dispose them.</returns> | |
public static IEnumerable<T> SynchronizeWith<T>(this ObservableCollection<T> source, |
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 class LoggerAdapter | |
{ | |
private const string NullString = "<NULL>"; | |
private readonly Type _type; | |
public LoggerAdapter(Type type) | |
{ | |
_type = type; | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> | |
<Tracer adapterAssembly="Tests" | |
logManager="Tests.LogManagerAdapter" | |
logger="Tests.Tracer.LoggerAdapter" | |
staticLogger="Tests.Tracer.Log" | |
traceConstructors="false" traceProperties="false"> | |
</Tracer> | |
<MethodDecorator /> | |
</Weavers> |
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 testName = CoerceValidFileName(TestContext.CurrentContext.Test.FullName); | |
tempLocalFolder = Path.Combine(Root, "temp", testName); | |
/// <remarks> | |
/// http://stackoverflow.com/questions/309485/c-sharp-sanitize-file-name | |
/// </remarks> | |
public static string CoerceValidFileName(string filename) | |
{ | |
var invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars())); | |
var invalidReStr = string.Format(@"[{0}]+", invalidChars); |
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 static void SendKeysGently(this IWebElement typeTo, string text, int retryCount = 10) | |
{ | |
bool introduceDelay = false; | |
Policy.Handle<Exception>() | |
.WaitAndRetry(retryCount, i => TimeSpan.FromMilliseconds(500), | |
(exception, timeSpan, retry, context) => | |
{ | |
introduceDelay = retry > 5; | |
}) | |
.Execute(() => |
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 static void ClearForChrome(this IWebElement webElement) | |
{ | |
webElement.Click(); | |
if (!string.IsNullOrEmpty(webElement.GetAttribute("value"))) | |
{ | |
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | |
{ | |
webElement.SendKeys(Keys.Control + 'a'); | |
} |
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 class HttpMetricsMiddleware | |
{ | |
private readonly RequestDelegate next; | |
private static readonly Gauge httpInProgress = Prometheus.Metrics.CreateGauge("http_requests_in_progress", "Number or requests in progress", "system"); | |
private static readonly Histogram httpRequestsDuration = Prometheus.Metrics.CreateHistogram("http_requests_duration_seconds", "Duration of http requests per tracking system", "system"); | |
public HttpMetricsMiddleware(RequestDelegate next) | |
{ | |
this.next = next; | |
} |
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
import http from 'k6/http' | |
import { check, group, sleep } from 'k6' | |
import { Trend, Rate, Counter } from 'k6/metrics' | |
// var host = "http://localhost/headquarters" | |
//var tag = "6KCM4SN5" | |
// var host = "https://hqrc.mysurvey.solutions" | |
// var host = "http://192.168.88.24:57627" |
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 sealed class NpgsqlMetricsCollectionService : EventListener, IHostedService | |
{ | |
public Task StartAsync(CancellationToken cancellationToken) => Task.CompletedTask; | |
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; | |
protected override void OnEventWritten(EventWrittenEventArgs eventData) | |
{ | |
if (eventData.EventName != "EventCounters" | |
|| eventData.Payload.Count <= 0 | |
|| !(eventData.Payload[0] is IDictionary<string, object> data) |
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 class ProgressiveDownload | |
{ | |
private readonly HttpRequestMessage request; | |
public ProgressiveDownload(HttpRequestMessage request) | |
{ | |
this.request = request; | |
} | |
public HttpResponseMessage HeaderInfoMessage(long contentLength, string mediaType) |
NewerOlder