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
using System; | |
namespace Preconditions | |
{ | |
/// <summary> | |
/// Preconditions for checking method arguments, state etc. | |
/// </summary> | |
public static class Preconditions | |
{ | |
/// <summary> |
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
<ResourceDictionary | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.14.0"> | |
<Style TargetType="UserControl"> | |
<Setter Property="Background" Value="{DynamicResource {x:Static vs:EnvironmentColors.ToolWindowBackgroundBrushKey}}" /> | |
<Setter Property="Foreground" Value="{DynamicResource {x:Static vs:EnvironmentColors.ToolWindowTextBrushKey}}"/> | |
</Style> |
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
using Autofac; | |
using Autofac.Core; | |
using Cloudinator.Portal.WebApi.Infrastructure; | |
using Cloudinator.Portal.WebApi.Infrastructure.Handlers; | |
using FluentValidation; | |
using MediatR; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; |
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
class SignalGenerator | |
{ | |
long startTime = Stopwatch.GetTimestamp(); | |
long ticksPerSecond = Stopwatch.Frequency; | |
float amplitude = 1f; | |
float frequency = 1f; | |
float phase = 1f; | |
float offset = 0f; | |
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
class SignalGenerator | |
{ | |
long startTime = Stopwatch.GetTimestamp(); | |
long ticksPerSecond = Stopwatch.Frequency; | |
float amplitude = 1f; | |
float frequency = 1f; | |
float phase = 1f; | |
float offset = 0f; | |
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 MediatorPipelineModule : Autofac.Module | |
{ | |
protected override void Load(ContainerBuilder builder) | |
{ | |
RegisterPipeline(builder); | |
RegisterAsyncPreRequestHandlers(builder); | |
RegisterAsyncPostRequestHandlers(builder); | |
RegisterPreRequestHandlers(builder); | |
RegisterPostRequestHandlers(builder); | |
} |
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 interface IPreRequestHandler<in TRequest> | |
{ | |
void Handle(TRequest request); | |
} | |
public interface IAsyncPreRequestHandler<in TRequest> | |
{ | |
Task Handle(TRequest request); | |
} |
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 AsyncMediatorPipeline<TRequest, TResponse> : IAsyncRequestHandler<TRequest, TResponse> | |
where TRequest : IAsyncRequest<TResponse> | |
{ | |
private readonly IAsyncRequestHandler<TRequest, TResponse> _inner; | |
private readonly IAsyncPreRequestHandler<TRequest>[] _preRequestHandlers; | |
private readonly IAsyncPostRequestHandler<TRequest, TResponse>[] _postRequestHandlers; | |
public AsyncMediatorPipeline( | |
IAsyncRequestHandler<TRequest, TResponse> inner, | |
IAsyncPreRequestHandler<TRequest>[] preRequestHandlers, |
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 MediatorPipeline<TRequest, TResponse> | |
: IRequestHandler<TRequest, TResponse> | |
where TRequest : IRequest<TResponse> | |
{ | |
private readonly IRequestHandler<TRequest, TResponse> _inner; | |
private readonly IPreRequestHandler<TRequest>[] _preRequestHandlers; | |
private readonly IAsyncPostRequestHandler<TRequest, TResponse>[] _postRequestHandlers; | |
public MediatorPipeline( | |
IRequestHandler<TRequest, TResponse> inner, |
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 loadTest = NLoad.Test<MyTest>() | |
.WithNumberOfThreads(100) | |
.WithDurationOf(TimeSpan.FromMinutes(5)) | |
.WithDeleyBetweenThreadStart(TimeSpan.FromMilliseconds(50)) | |
.OnHeartbeat((s, e) => Console.WriteLine(e.Throughput)) | |
.Build(); | |
var result = loadTest.Run(); |