Full Code of Polly-Contrib/Simmy for AI

master 0a52b0a134f0 cached
87 files
553.9 KB
113.3k tokens
590 symbols
1 requests
Download .txt
Showing preview only (587K chars total). Download the full file or copy to clipboard to get everything.
Repository: Polly-Contrib/Simmy
Branch: master
Commit: 0a52b0a134f0
Files: 87
Total size: 553.9 KB

Directory structure:
gitextract_az8v0g9u/

├── .gitignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── GitVersionConfig.yaml
├── LICENSE.txt
├── README.md
├── appveyor.yml
├── build.bat
├── build.cake
├── build.ps1
└── src/
    ├── Polly.Contrib.Simmy/
    │   ├── AsyncMonkeyEngine.cs
    │   ├── AsyncMonkeyPolicy.cs
    │   ├── Behavior/
    │   │   ├── AsyncInjectBehaviourOptionsSyntax.cs
    │   │   ├── AsyncInjectBehaviourPolicy.cs
    │   │   ├── AsyncInjectBehaviourSyntax.cs
    │   │   ├── AsyncInjectBehaviourTResultOptionsSyntax.cs
    │   │   ├── AsyncInjectBehaviourTResultSyntax.cs
    │   │   ├── InjectBehaviourAsyncOptions.cs
    │   │   ├── InjectBehaviourAsyncOptionsExtensions.cs
    │   │   ├── InjectBehaviourOptions.cs
    │   │   ├── InjectBehaviourOptionsExtensions.cs
    │   │   ├── InjectBehaviourOptionsSyntax.cs
    │   │   ├── InjectBehaviourPolicy.cs
    │   │   ├── InjectBehaviourSyntax.cs
    │   │   ├── InjectBehaviourTResultOptionsSyntax.cs
    │   │   └── InjectBehaviourTResultSyntax.cs
    │   ├── IMonkeyPolicy.cs
    │   ├── InjectOptionsAsyncBase.cs
    │   ├── InjectOptionsAsyncBaseExtensions.cs
    │   ├── InjectOptionsBase.cs
    │   ├── InjectOptionsBaseExtensions.cs
    │   ├── Latency/
    │   │   ├── AsyncInjectLatencyOptionsSyntax.cs
    │   │   ├── AsyncInjectLatencyPolicy.cs
    │   │   ├── AsyncInjectLatencySyntax.cs
    │   │   ├── InjectLatencyAsyncOptions.cs
    │   │   ├── InjectLatencyAsyncOptionsExtensions.cs
    │   │   ├── InjectLatencyOptions.cs
    │   │   ├── InjectLatencyOptionsExtensions.cs
    │   │   ├── InjectLatencyOptionsSyntax.cs
    │   │   ├── InjectLatencyPolicy.cs
    │   │   └── InjectLatencySyntax.cs
    │   ├── MonkeyEngine.cs
    │   ├── MonkeyPolicy.cs
    │   ├── Outcomes/
    │   │   ├── AsyncInjectOutcomeOptionsSyntax.cs
    │   │   ├── AsyncInjectOutcomePolicy.cs
    │   │   ├── AsyncInjectOutcomeSyntax.cs
    │   │   ├── InjectOutcomeAsyncOptions.cs
    │   │   ├── InjectOutcomeAsyncOptionsExtensions.cs
    │   │   ├── InjectOutcomeOptions.cs
    │   │   ├── InjectOutcomeOptionsExtensions.cs
    │   │   ├── InjectOutcomeOptionsSyntax.cs
    │   │   ├── InjectOutcomePolicy.cs
    │   │   └── InjectOutcomeSyntax.cs
    │   ├── Polly.Contrib.Simmy.csproj
    │   └── Utilities/
    │       ├── GuardExtensions.cs
    │       └── ThreadSafeRandom_LockOncePerThread.cs
    ├── Polly.Contrib.Simmy.Specs/
    │   ├── Behavior/
    │   │   ├── InjectBehaviourAsyncSpecs.cs
    │   │   ├── InjectBehaviourAsyncWithOptionsSpecs.cs
    │   │   ├── InjectBehaviourSpecs.cs
    │   │   ├── InjectBehaviourTResultAsyncSpecs.cs
    │   │   ├── InjectBehaviourTResultAsyncWithOptionsSpecs.cs
    │   │   ├── InjectBehaviourTResultSpecs.cs
    │   │   ├── InjectBehaviourTResultWithOptionsSpecs.cs
    │   │   └── InjectBehaviourWithOptionsSpecs.cs
    │   ├── Helpers/
    │   │   ├── Constants.cs
    │   │   └── ResultPrimitive.cs
    │   ├── Latency/
    │   │   ├── InjectLatencyAsyncSpecs.cs
    │   │   ├── InjectLatencyAsyncWithOptionsSpecs.cs
    │   │   ├── InjectLatencySpecs.cs
    │   │   ├── InjectLatencyTResultAsyncSpecs .cs
    │   │   ├── InjectLatencyTResultAsyncWithOptionsSpecs.cs
    │   │   ├── InjectLatencyTResultSpecs.cs
    │   │   ├── InjectLatencyTResultWithOptionsSpecs.cs
    │   │   └── InjectLatencyWithOptionsSpecs.cs
    │   ├── Outcomes/
    │   │   ├── InjectFaultAsyncSpecs.cs
    │   │   ├── InjectFaultAsyncWithOptionsSpecs.cs
    │   │   ├── InjectFaultSpecs.cs
    │   │   ├── InjectFaultTResultAsyncSpecs.cs
    │   │   ├── InjectFaultTResultAsyncWithOptionsSpecs.cs
    │   │   ├── InjectFaultTResultSpecs.cs
    │   │   ├── InjectFaultTResultWithOptionsSpecs.cs
    │   │   └── InjectFaultWithOptionsSpecs.cs
    │   └── Polly.Contrib.Simmy.Specs.csproj
    ├── Polly.Contrib.Simmy.nuspec
    ├── Polly.Contrib.Simmy.sln
    └── Polly.Contrib.Simmy.snk

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/

# mstest test results
TestResults

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates
.vs/
.vscode/
.idea

# Build results
[Dd]ebug/
[Rr]elease/
x64/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.vspscc
*.vssscc
.builds

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# GhostDoc
*.GhostDoc.xml

# Installshield output folder 
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Publish Web Output
*.Publish.xml

# NuGet Packages Directory
packages

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
[Bb]in
[Oo]bj
sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
[Ss]tyle[Cc]op.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML

artifacts
build
tools

*.lock.json
*.nuget.targets
*.nuget.props


================================================
FILE: CHANGELOG.md
================================================
## 0.3.0
- Add a new Fluent-builder syntax 
- Add intuitive syntax for result stubbing, for use in unit-tests or in other systems on how those systems handle faults
- Compiles on mac and linux
- Add support for .NET Standard 2.1
- Validates constant `injectionRate` at Policy configuration time

## 0.2.0
- Makes InjectLatency policies cancellable (both sync and async)
- Add support for cancellation on async configuration-providing delegates 

## 0.1.0
- Initial launch


================================================
FILE: CODE_OF_CONDUCT.md
================================================
We ask our contributors to abide by the [Code of Conduct of the .NET Foundation](https://www.dotnetfoundation.org/code-of-conduct).


================================================
FILE: CONTRIBUTING.md
================================================
Please see the Instructions for Contributing in the [Polly ReadMe](https://github.com/App-vNext/Polly#instructions-for-contributing) and [Polly wiki](https://github.com/App-vNext/Polly/wiki/Git-Workflow).



================================================
FILE: GitVersionConfig.yaml
================================================
next-version: 0.3.0

================================================
FILE: LICENSE.txt
================================================
New BSD License
=
Copyright (c) 2018-2019, App vNext
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of App vNext nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


================================================
FILE: README.md
================================================
# Simmy



Simmy is a [chaos-engineering](http://principlesofchaos.org/) and fault-injection tool, integrating with the [Polly resilience project for .NET](https://github.com/App-vNext/Polly).  It is releasing April 2019 and works with [Polly v7.0.0](https://www.nuget.org/packages/Polly/7.1.0) onwards.

Simmy allows you to introduce a chaos-injection policy or policies at any location where you execute code through Polly.

[![NuGet version](https://badge.fury.io/nu/Polly.Contrib.Simmy.svg)](https://badge.fury.io/nu/Polly.Contrib.Simmy) [![Build status](https://ci.appveyor.com/api/projects/status/5v3bpgjkw4snv3no?svg=true)](https://ci.appveyor.com/project/Polly-Contrib/simmy) [![Slack Status](http://www.pollytalk.org/badge.svg)](http://www.pollytalk.org)

<img src="./Simmy_lg.png" alt="Simmy"  width="300"/>

# Motivation

There are a lot of questions when it comes to chaos-engineering and making sure that a system is actually ready to face the worst possible scenarios:

* Is my system resilient enough?
* Am I handling the right exceptions/scenarios?
* How will my system behave if X happens?
* How can I test without waiting for a handled (or even unhandled) exception to happen in my production environment?

Using Polly helps me introduce resilience to my project, but I don't want to have to wait for expected or unexpected failures to test it out. My resilience could be wrongly implemented; testing the scenarios is not straight forward; and mocking failure of some dependencies (for example a cloud SaaS or PaaS service) is not always straightforward.

**What do I need, to simulate chaotic scenarios in my production environment?**

* A way to mock failures of dependencies (any service dependency for example).
* Define when to fail based on some external factors - maybe global configuration or some rule.
* A way to revert easily, to control the blast radius.
* Production grade, to run this in a production or near-production system with automation.

# Chaos policies

Simmy offers the following chaos-injection policies:

|Policy| What does the policy do?|
| ------------- |------------- |
|**[Exception](#Inject-exception)**|Injects exceptions in your system.|
|**[Result](#Inject-result)**|Substitute results to fake faults in your system.|
|**[Latency](#Inject-latency)**|Injects latency into executions before the calls are made.|
|**[Behavior](#Inject-behavior)**|Allows you to inject _any_ extra behaviour, before a call is placed. |

# Usage
## Step 1: Set up the Monkey Policy

## Inject exception
```csharp
var chaosPolicy = MonkeyPolicy.InjectException(Action<InjectOutcomeOptions<Exception>>);
```
For example:
```csharp
// Following example causes the policy to throw SocketException with a probability of 5% if enabled
var fault = new SocketException(errorCode: 10013);
var chaosPolicy = MonkeyPolicy.InjectException(with =>
	with.Fault(fault)
		.InjectionRate(0.05)
		.Enabled()
	);
```

## Inject result
```csharp
var chaosPolicy = MonkeyPolicy.InjectResult(Action<InjectOutcomeOptions<TResult>>);
```
For example:
```csharp
// Following example causes the policy to return a bad request HttpResponseMessage with a probability of 5% if enabled
var result = new HttpResponseMessage(HttpStatusCode.BadRequest);
var chaosPolicy = MonkeyPolicy.InjectResult<HttpResponseMessage>(with =>
	with.Result(result)
		.InjectionRate(0.05)
		.Enabled()
);
```

## Inject latency
```csharp
var chaosPolicy = MonkeyPolicy.InjectLatency(Action<InjectLatencyOptions>);
```
For example:
```csharp
// Following example causes policy to introduce an added latency of 5 seconds to a randomly-selected 10% of the calls.
var isEnabled = true;
var chaosPolicy = MonkeyPolicy.InjectLatency(with =>
	with.Latency(TimeSpan.FromSeconds(5))
		.InjectionRate(0.1)
		.Enabled(isEnabled)
	);
```

## Inject behavior
```csharp
var chaosPolicy = MonkeyPolicy.InjectBehaviour(Action<InjectBehaviourOptions>);
```
For example:
```csharp
// Following example causes policy to execute a method to restart a virtual machine; the probability that method will be executed is 1% if enabled
var chaosPolicy = MonkeyPolicy.InjectBehaviour(with =>
	with.Behaviour(() => restartRedisVM())
		.InjectionRate(0.01)
		.EnabledWhen((ctx, ct) => isEnabled(ctx, ct))
	);
```

## Parameters
All the parameters are expressed in a Fluent-builder syntax way.

### Enabled
Determines whether the policy is enabled or not.

* Configure that the monkey policy is enabled. 
```csharp
PolicyOptions.Enabled();
```

* Receives a boolean value indicating whether the monkey policy is enabled.
```csharp
PolicyOptions.Enabled(bool);
```

* Receives a delegate which can be executed to determine whether the monkey policy should be enabled.
```csharp
PolicyOptions.EnabledWhen(Func<Context, CancellationToken, bool>);
```

### InjectionRate
A decimal between 0 and 1 inclusive. The policy will inject the fault, randomly, that proportion of the time, eg: if 0.2, twenty percent of calls will be randomly affected; if 0.01, one percent of calls; if 1, all calls. 

* Receives a double value between [0, 1] indicating the rate at which this monkey policy should inject chaos.
```csharp
PolicyOptions.InjectionRate(Double);
```

* Receives a delegate which can be executed to determine the rate at which this monkey policy should inject chaos.
```csharp
PolicyOptions.InjectionRate(Func<Context, CancellationToken, Double>);
```

### Fault
The fault to inject. The `Fault` api has overloads to build the policy in a generic way: `PolicyOptions.Fault<TResult>(...)`

* Receives an exception to configure the fault to inject with the monkey policy.
```csharp
PolicyOptions.Fault(Exception);
```

* Receives a delegate representing the fault to inject with the monkey policy.
```csharp
PolicyOptions.Fault(Func<Context, CancellationToken, Exception>);
```

### Result
The result to inject.

* Receives a generic TResult value to configure the result to inject with the monkey policy.
```csharp
PolicyOptions.Result<TResult>(TResult);
```

* Receives a delegate representing the result to inject with the monkey policy.
```csharp
PolicyOptions.Result<TResult>(Func<Context, CancellationToken, TResult>);
```

### Latency
The latency to inject.

* Receives a TimeSpan value to configure the latency to inject with the monkey policy.
```csharp
PolicyOptions.Latency(TimeSpan);
```

* Receives a delegate representing the latency to inject with the monkey policy.
```csharp
PolicyOptions.Latency(Func<Context, CancellationToken, TimeSpan>);
```

### Behaviour
The behaviour to inject. 

* Receives an Action to configure the behaviour to inject with the monkey policy.
```csharp
PolicyOptions.Behaviour(Action);
```

* Receives a delegate representing the Action to inject with the monkey policy.
```csharp
PolicyOptions.Behaviour(Action<Context, CancellationToken>);
```

### Context-driven behaviour

All parameters are available in a `Func<Context, ...>` form.  This allows you to control the chaos injected:

+ in a **dynamic** manner: by eg driving the chaos from external configuration files
+ in a **targeted** manner: by tagging your policy executions with a [`Context.OperationKey`](https://github.com/App-vNext/Polly/wiki/Keys-And-Context-Data#pre-defined-keys-on-context) and introducing chaos targeting particular tagged operations

The [example app](https://github.com/Polly-Contrib/Polly.Contrib.SimmyDemo_WebApi) demonstrates both these approaches in practice.


## Step 2: Execute code through the Monkey Policy

```csharp
// Executes through the chaos policy directly
chaosPolicy.Execute(() => someMethod());

// Executes through the chaos policy using Context
chaosPolicy.Execute((ctx) => someMethod(), context);

// Wrap the chaos policy inside other Polly resilience policies, using PolicyWrap
var policyWrap = Policy
  .Wrap(fallbackPolicy, timeoutPolicy, chaosLatencyPolicy);
policyWrap.Execute(() => someMethod())

// All policies are also available in async forms.
var chaosLatencyPolicy = MonkeyPolicy.InjectLatencyAsync(with =>
	with.Latency(TimeSpan.FromSeconds(5))
		.InjectionRate(0.1)
		.Enabled()
	);
var policyWrap = Policy
  .WrapAsync(fallbackPolicy, timeoutPolicy, chaosLatencyPolicy);
var result = await policyWrap.ExecuteAsync(token => service.GetFoo(parametersBar, token), myCancellationToken);

// For general information on Polly policy syntax see: https://github.com/App-vNext/Polly
```

It is usual to place the Simmy policy innermost in a PolicyWrap. By placing the chaos policies innermost, they subvert the usual outbound call at the last minute, substituting their fault or adding extra latency. The existing Polly policies - further out in the PolicyWrap - still apply, so you can test how the Polly resilience you have configured handles the chaos/faults injected by Simmy.

**Note:** The above examples demonstrate how to execute through a Simmy policy directly, and how to include a Simmy policy in an individual PolicyWrap. If your policies are configured by .NET Core DI at StartUp, for example via HttpClientFactory, there are also patterns which can configure Simmy into your app as a whole, at StartUp. See the Simmy Sample App discussed below.

## Example app: Controlling chaos via configuration and Polly.Context

This [Simmy sample app](https://github.com/Polly-Contrib/Polly.Contrib.SimmyDemo_WebApi) shows different approaches/patterns for how you can configure Simmy to introduce chaos policies in a project.  Patterns demonstrated are:

* Configuring `StartUp` so that Simmy chaos policies are only introduced in builds for certain environments (for instance, Dev but not Prod).
* Configuring Simmy chaos policies to be injected into the app without changing any existing Polly configuration code.
* Injecting faults or chaos by modifying external configuration. 

The patterns shown in the sample app are intended as starting points but are not mandatory.  Simmy is very flexible, and we would love to hear how you use it!

## Wrapping up

All chaos policies (Monkey policies) are designed to inject behavior randomly (faults, latency or custom behavior), so a Monkey policy allows you to specify an injection rate between 0 and 1 (0-100%) thus, the higher is the injection rate the higher is the probability to inject them. Also it allows you to specify whether or not the random injection is enabled, that way you can release/hold (turn on/off) the monkeys regardless of injection rate you specify, it means, if you specify an injection rate of 100% but you tell to the policy that the random injection is disabled, it will do nothing.

## Further information

See [Issues](https://github.com/App-vNext/Simmy/issues) for latest discussions on taking Simmy forward!

## Credits

Simmy was [the brainchild of](https://github.com/App-vNext/Polly/issues/499) [@mebjas](https://github.com/mebjas) and [@reisenberger](https://github.com/reisenberger). The major part of the implementation was by [@vany0114](https://github.com/vany0114) and [@mebjas](https://github.com/mebjas), with contributions also from [@reisenberger](https://github.com/reisenberger) of the Polly team.

## Blogs and architecture samples around Simmy

### Blog posts
* [Simmy, the monkey for making chaos](http://elvanydev.com/chaos-injection-with-simmy/) -by [Geovanny Alzate Sandoval](https://twitter.com/geovany0114)
* [Simmy and Azure App Configuration](http://elvanydev.com/simmy-with-azure-app-configuration/) -by [Geovanny Alzate Sandoval](https://twitter.com/geovany0114)
* [Simmy Chaos Engine for .NET – Part 1, Injecting Faults](https://nodogmablog.bryanhogan.net/2019/07/simmy-chaos-engine-for-net-part-1-injecting-faults/) -by [Bryan Hogan](https://twitter.com/bryanjhogan)
* [Simmy Chaos Engine for .NET – Part 2, Resilience and Injected Faults](https://nodogmablog.bryanhogan.net/2019/07/simmy-chaos-engine-for-net-part-2-resilience-and-injected-faults/) -by [Bryan Hogan](https://twitter.com/bryanjhogan)
* [Chaos Engineering your .NET applications using Simmy](http://josephwoodward.co.uk/2020/01/chaos-engineering-your-dot-net-application-simmy) -by [Joseph Woodward](https://twitter.com/joe_mighty)

### Samples
* [Dylan Reisenberger](http://www.thepollyproject.org/author/dylan/) presents an [intentionally simple example](https://github.com/Polly-Contrib/Polly.Contrib.SimmyDemo_WebApi) .NET Core WebAPI app demonstrating how we can set up Simmy chaos policies for certain environments and without changing any existing configuration code injecting faults or chaos by modifying external configuration.

* [Geovanny Alzate Sandoval](https://github.com/vany0114) made a [microservices based sample application](https://github.com/vany0114/chaos-injection-using-simmy) to demonstrate how chaos engineering works with Simmy using chaos policies in a distributed system and how we can inject even a custom behavior given our needs or infrastructure, this time injecting custom behavior to generate chaos in our Service Fabric Cluster.

 * [Bjørn Einar Bjartnes](https://github.com/bjartwolf) made a [red-green load-testing resilience workshop](https://github.com/bjartnes/bounded-disturbances) to understand how errors and resiliency mechanisms affect a system under load. It has been used to run workshops at for example [NDC Oslo](https://ndcoslo.com/workshops/building-and-testing-resilient-services/dbb2ed362bcc) and there is a video from the workshop at [DotNext](https://www.youtube.com/watch?v=_UFiaNlfxjI).

================================================
FILE: appveyor.yml
================================================
os: Visual Studio 2019

# Build script
build_script:
  - ps: .\build.ps1

# Tests
test: off

artifacts:
  - path: artifacts\nuget-package\*.nupkg

environment:
  # Skip dotnet package caching on build servers
  DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

================================================
FILE: build.bat
================================================
@ECHO OFF
PUSHD %~dp0
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& './build.ps1'"

IF %errorlevel% neq 0 PAUSE



================================================
FILE: build.cake
================================================
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////

var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");

//////////////////////////////////////////////////////////////////////
// EXTERNAL NUGET TOOLS
//////////////////////////////////////////////////////////////////////

#tool nuget:?package=xunit.runner.console&version=2.4.1
#tool nuget:?package=GitVersion.CommandLine&version=5.0.1
#tool nuget:?package=Brutal.Dev.StrongNameSigner&version=2.4.0

//////////////////////////////////////////////////////////////////////
// EXTERNAL NUGET LIBRARIES
//////////////////////////////////////////////////////////////////////

#addin nuget:?package=Cake.FileHelpers&version=3.2.1

///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////

var projectName = "Polly.Contrib.Simmy";
var keyName = "Polly.Contrib.Simmy.snk";

var solutions = GetFiles("./**/*.sln");
var solutionPaths = solutions.Select(solution => solution.GetDirectory());

var srcDir = Directory("./src");
var buildDir = Directory("./build");
var artifactsDir = Directory("./artifacts");
var testResultsDir = artifactsDir + Directory("test-results");

// NuGet
var nuspecFilename = projectName + ".nuspec";
var nuspecSrcFile = srcDir + File(nuspecFilename);
var nuspecDestFile = buildDir + File(nuspecFilename);
var nupkgDestDir = artifactsDir + Directory("nuget-package");
var snkFile = srcDir + File(keyName);

// Gitversion
var gitVersionPath = ToolsExePath("GitVersion.exe");
Dictionary<string, object> gitVersionOutput;

// Versioning
string nugetVersion;
string appveyorBuildNumber;
string assemblyVersion;
string assemblySemver;

// StrongNameSigner
var strongNameSignerPath = ToolsExePath("StrongNameSigner.Console.exe");


///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////

Setup(_ =>
{
    Information("");
    Information(" ███████╗██╗███╗   ███╗███╗   ███╗██╗   ██╗");
    Information(" ██╔════╝██║████╗ ████║████╗ ████║╚██╗ ██╔╝");
    Information(" ███████╗██║██╔████╔██║██╔████╔██║ ╚████╔╝ ");
    Information(" ╚════██║██║██║╚██╔╝██║██║╚██╔╝██║  ╚██╔╝  ");
    Information(" ███████║██║██║ ╚═╝ ██║██║ ╚═╝ ██║   ██║   ");
    Information(" ╚══════╝╚═╝╚═╝     ╚═╝╚═╝     ╚═╝   ╚═╝   ");
    Information("");
});

Teardown(_ =>
{
    Information("Finished running tasks.");
});

//////////////////////////////////////////////////////////////////////
// PRIVATE TASKS
//////////////////////////////////////////////////////////////////////

Task("__Clean")
    .Does(() =>
{
    DirectoryPath[] cleanDirectories = new DirectoryPath[] {
        buildDir,
        testResultsDir,
        nupkgDestDir,
        artifactsDir
  	};

    CleanDirectories(cleanDirectories);

    foreach(var path in cleanDirectories) { EnsureDirectoryExists(path); }

    foreach(var path in solutionPaths)
    {
        Information("Cleaning {0}", path);
        CleanDirectories(path + "/**/bin/" + configuration);
        CleanDirectories(path + "/**/obj/" + configuration);
    }
});

Task("__RestoreNugetPackages")
    .Does(() =>
{
    foreach(var solution in solutions)
    {
        Information("Restoring NuGet Packages for {0}", solution);
        NuGetRestore(solution);
    }
});

Task("__UpdateAssemblyVersionInformation")
    .Does(() =>
{
    var gitVersionSettings = new ProcessSettings()
        .SetRedirectStandardOutput(true);

    IEnumerable<string> outputLines;
    StartProcess(gitVersionPath, gitVersionSettings, out outputLines);

    var output = string.Join("\n", outputLines);
    gitVersionOutput = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(output);

    Information("Updated GlobalAssemblyInfo");

    Information("");
    Information("Obtained raw version info for package versioning:");
    Information("NuGetVersion -> {0}", gitVersionOutput["NuGetVersion"]);
    Information("FullSemVer -> {0}", gitVersionOutput["FullSemVer"]);
    Information("AssemblySemVer -> {0}", gitVersionOutput["AssemblySemVer"]);

    appveyorBuildNumber = gitVersionOutput["FullSemVer"].ToString();
    nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
    assemblyVersion = gitVersionOutput["Major"].ToString() + ".0.0.0";
    assemblySemver = gitVersionOutput["AssemblySemVer"].ToString();

    Information("");
    Information("Mapping versioning information to:");
    Information("Appveyor build number -> {0}", appveyorBuildNumber);
    Information("Nuget package version -> {0}", nugetVersion);
    Information("AssemblyVersion -> {0}", assemblyVersion);
    Information("AssemblyFileVersion -> {0}", assemblySemver);
    Information("AssemblyInformationalVersion -> {0}", assemblySemver);
});

Task("__UpdateDotNetStandardAssemblyVersionNumber")
    .Does(() =>
{
    Information("Updating Assembly Version Information");

    var attributeToValueMap = new Dictionary<string, string>() {
        { "AssemblyVersion", assemblyVersion },
        { "FileVersion", assemblySemver },
        { "InformationalVersion", assemblySemver },
        { "Version", nugetVersion },
        { "PackageVersion", nugetVersion },
    };

    var csproj = File("./src/Polly.Contrib.Simmy/Polly.Contrib.Simmy.csproj");

    foreach(var attributeMap in attributeToValueMap) {
        var attribute = attributeMap.Key;
        var value = attributeMap.Value;

        var replacedFiles = ReplaceRegexInFiles(csproj, $@"\<{attribute}\>[^\<]*\</{attribute}\>", $@"<{attribute}>{value}</{attribute}>");
        if (!replacedFiles.Any())
        {
            throw new Exception($"{attribute} version could not be updated in {csproj}.");
        }
    }

});

Task("__UpdateAppVeyorBuildNumber")
    .WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
    .Does(() =>
{
    AppVeyor.UpdateBuildVersion(appveyorBuildNumber);
});

Task("__BuildSolutions")
    .Does(() =>
{
    foreach(var solution in solutions)
    {
        Information("Building {0}", solution);

        MSBuild(solution, settings =>
            settings
                .SetConfiguration(configuration)
                .WithProperty("TreatWarningsAsErrors", "true")
                .UseToolVersion(MSBuildToolVersion.VS2019)
                .SetVerbosity(Verbosity.Minimal)
                .SetNodeReuse(false));
    }
});

Task("__RunTests")
    .Does(() =>
{
    foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")) {
        DotNetCoreTest(specsProj.FullPath, new DotNetCoreTestSettings {
            Configuration = configuration,
            NoBuild = true
        });
    }
});

Task("__CopyOutputToNugetFolder")
    .Does(() =>
{
    var sourceDir = srcDir + Directory("Polly.Contrib.Simmy") + Directory("bin") + Directory(configuration);

    var destDir = buildDir + Directory("lib");

    Information("Copying {0} -> {1}.", sourceDir, destDir);
    CopyDirectory(sourceDir, destDir);

    CopyFile(nuspecSrcFile, nuspecDestFile);
});

Task("__StronglySignAssemblies")
    .Does(() =>
{
    //see: https://github.com/brutaldev/StrongNameSigner
    var strongNameSignerSettings = new ProcessSettings()
        .WithArguments(args => args
            .Append("-in")
            .AppendQuoted(buildDir)
            .Append("-k")
            .AppendQuoted(snkFile)
            .Append("-l")
            .AppendQuoted("Changes"));

    StartProcess(strongNameSignerPath, strongNameSignerSettings);
});

Task("__CreateSignedNugetPackage")
    .Does(() =>
{
    var packageName = projectName;

    Information("Building {0}.{1}.nupkg", packageName, nugetVersion);

    var nuGetPackSettings = new NuGetPackSettings {
        Id = packageName,
        Title = packageName,
        Version = nugetVersion,
        OutputDirectory = nupkgDestDir
    };

    NuGetPack(nuspecDestFile, nuGetPackSettings);
});

//////////////////////////////////////////////////////////////////////
// BUILD TASKS
//////////////////////////////////////////////////////////////////////

Task("Build")
    .IsDependentOn("__Clean")
    .IsDependentOn("__RestoreNugetPackages")
    .IsDependentOn("__UpdateAssemblyVersionInformation")
    .IsDependentOn("__UpdateDotNetStandardAssemblyVersionNumber")
    .IsDependentOn("__UpdateAppVeyorBuildNumber")
    .IsDependentOn("__BuildSolutions")
    .IsDependentOn("__RunTests")
    .IsDependentOn("__CopyOutputToNugetFolder")
    .IsDependentOn("__StronglySignAssemblies")
    .IsDependentOn("__CreateSignedNugetPackage");

///////////////////////////////////////////////////////////////////////////////
// PRIMARY TARGETS
///////////////////////////////////////////////////////////////////////////////

Task("Default")
    .IsDependentOn("Build");

///////////////////////////////////////////////////////////////////////////////
// EXECUTION
///////////////////////////////////////////////////////////////////////////////

RunTarget(target);

//////////////////////////////////////////////////////////////////////
// HELPER FUNCTIONS
//////////////////////////////////////////////////////////////////////

string ToolsExePath(string exeFileName) {
    var exePath = System.IO.Directory.GetFiles(@".\Tools", exeFileName, SearchOption.AllDirectories).FirstOrDefault();
    return exePath;
}


================================================
FILE: build.ps1
================================================
<#

.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.

.DESCRIPTION
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
and execute your Cake build script with the parameters you provide.

.PARAMETER Script
The build script to execute.
.PARAMETER Target
The build script target to run.
.PARAMETER Configuration
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
.PARAMETER Experimental
Tells Cake to use the latest Roslyn release.
.PARAMETER WhatIf
Performs a dry run of the build script.
No tasks will be executed.
.PARAMETER Mono
Tells Cake to use the Mono scripting engine.

.LINK
http://cakebuild.net
#>

Param(
    [string]$Script = "build.cake",
    [string]$Target = "Default",
    [string]$Configuration = "Release",
    [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
    [string]$Verbosity = "Verbose",
    [switch]$Experimental,
    [Alias("DryRun","Noop")]
    [switch]$WhatIf,
    [switch]$Mono,
    [switch]$SkipToolPackageRestore,
    [switch]$Verbose
)

Write-Host "Preparing to run build script..."

# Should we show verbose messages?
if($Verbose.IsPresent)
{
    $VerbosePreference = "continue"
}

$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"

# Should we use mono?
$UseMono = "";
if($Mono.IsPresent) {
    Write-Verbose -Message "Using the Mono based scripting engine."
    $UseMono = "-mono"
}

# Should we use the new Roslyn?
$UseExperimental = "";
if($Experimental.IsPresent -and !($Mono.IsPresent)) {
    Write-Verbose -Message "Using experimental version of Roslyn."
    $UseExperimental = "-experimental"
}

# Is this a dry run?
$UseDryRun = "";
if($WhatIf.IsPresent) {
    $UseDryRun = "-dryrun"
}

# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
    New-Item -Path $TOOLS_DIR -Type directory | out-null
}

# Try download NuGet.exe if not exists
if (!(Test-Path $NUGET_EXE)) {
    Write-Verbose -Message "Downloading NuGet.exe..."
    Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $NUGET_EXE
}

# Make sure NuGet exists where we expect it.
if (!(Test-Path $NUGET_EXE)) {
    Throw "Could not find NuGet.exe"
}

# Save nuget.exe path to environment to be available to child processed
$ENV:NUGET_EXE = $NUGET_EXE

# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent)
{
    # Restore tools from NuGet.
    Push-Location
    Set-Location $TOOLS_DIR

    Write-Verbose -Message "Restoring tools from NuGet..."

    # Restore packages
    if (Test-Path $PACKAGES_CONFIG)
    {
        $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion"
        Write-Verbose ($NuGetOutput | Out-String)
    }
    # Install just Cake if missing config
    else
    {
        $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install Cake -Version 0.35.0 -ExcludeVersion"
        Write-Verbose ($NuGetOutput | Out-String)
    }
    Pop-Location
    if ($LASTEXITCODE -ne 0)
    {
        exit $LASTEXITCODE
    }
}

# Make sure that Cake has been installed.
if (!(Test-Path $CAKE_EXE)) {
    Throw "Could not find Cake.exe"
}

# Start Cake
Write-Host "Running build script..."
Invoke-Expression "$CAKE_EXE `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental"
exit $LASTEXITCODE


================================================
FILE: src/Polly.Contrib.Simmy/AsyncMonkeyEngine.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Polly.Contrib.Simmy.Utilities;

namespace Polly.Contrib.Simmy
{
    internal static class AsyncMonkeyEngine
    {
        private static async Task<bool> ShouldInjectAsync(
            Context context, 
            CancellationToken cancellationToken, 
            Func<Context, CancellationToken, Task<double>> injectionRate, 
            Func<Context, CancellationToken, Task<bool>> enabled, 
            bool continueOnCapturedContext)
        {
            // to prevent execute config delegates if token is signaled before to start.
            cancellationToken.ThrowIfCancellationRequested();

            if (!await enabled(context, cancellationToken).ConfigureAwait(continueOnCapturedContext))
            {
                return false;
            }

            // to prevent execute injectionRate config delegate if token is signaled on enable configuration delegate.
            cancellationToken.ThrowIfCancellationRequested();

            double injectionThreshold = await injectionRate(context, cancellationToken).ConfigureAwait(continueOnCapturedContext);

            // to prevent execute further config delegates if token is signaled on injectionRate configuration delegate.
            cancellationToken.ThrowIfCancellationRequested();

            injectionThreshold.EnsureInjectionThreshold();
            return ThreadSafeRandom_LockOncePerThread.NextDouble() < injectionThreshold;
        }

        internal static async Task<TResult> InjectBehaviourImplementationAsync<TResult>(
            Func<Context, CancellationToken, Task<TResult>> action, 
            Context context,
            CancellationToken cancellationToken,
            Func<Context, CancellationToken, Task> injectedBehaviour,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled,
            bool continueOnCapturedContext)
        {
            if (await ShouldInjectAsync(context, cancellationToken, injectionRate, enabled, continueOnCapturedContext).ConfigureAwait(continueOnCapturedContext))
            {
                await injectedBehaviour(context, cancellationToken).ConfigureAwait(continueOnCapturedContext);
            }

            // to prevent execute the user's action if token is signaled on injectedBehaviour delegate.
            cancellationToken.ThrowIfCancellationRequested();
            return await action(context, cancellationToken).ConfigureAwait(continueOnCapturedContext);
        }

        internal static async Task<TResult> InjectExceptionImplementationAsync<TResult>(
            Func<Context, CancellationToken, Task<TResult>> action,
            Context context,
            CancellationToken cancellationToken,
            Func<Context, CancellationToken, Task<Exception>> injectedException,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled,
            bool continueOnCapturedContext)
        {
            if (await ShouldInjectAsync(context, cancellationToken, injectionRate, enabled, continueOnCapturedContext).ConfigureAwait(continueOnCapturedContext))
            {
                Exception exception = await injectedException(context, cancellationToken).ConfigureAwait(continueOnCapturedContext);

                // to prevent throws the exception if token is signaled on injectedException configuration delegate.
                cancellationToken.ThrowIfCancellationRequested();

                if (exception != null)
                {
                    throw exception;
                }
            }

            return await action(context, cancellationToken).ConfigureAwait(continueOnCapturedContext);
        }

        internal static async Task<TResult> InjectResultImplementationAsync<TResult>(
            Func<Context, CancellationToken, Task<TResult>> action,
            Context context,
            CancellationToken cancellationToken,
            Func<Context, CancellationToken, Task<TResult>> injectedResult,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled,
            bool continueOnCapturedContext)
        {
            if (await ShouldInjectAsync(context, cancellationToken, injectionRate, enabled, continueOnCapturedContext).ConfigureAwait(continueOnCapturedContext))
            {
                return await injectedResult(context, cancellationToken).ConfigureAwait(continueOnCapturedContext);
            }

            // to prevent inject the result if token is signaled on injectedResult delegate.
            cancellationToken.ThrowIfCancellationRequested();
            return await action(context, cancellationToken).ConfigureAwait(continueOnCapturedContext);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/AsyncMonkeyPolicy.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Contains common functionality for policies which intentionally disrupt async executions - which monkey around with calls.
    /// </summary>
    public abstract class AsyncMonkeyPolicy : AsyncPolicy, IMonkeyPolicy
    {
        internal Func<Context, CancellationToken, Task<Double>> InjectionRate { get; }
        internal Func<Context, CancellationToken, Task<bool>> Enabled { get; }

        internal AsyncMonkeyPolicy(Func<Context, CancellationToken, Task<Double>> injectionRate, Func<Context, CancellationToken, Task<bool>> enabled)
        {
            InjectionRate = injectionRate ?? throw new ArgumentNullException(nameof(injectionRate));
            Enabled = enabled ?? throw new ArgumentNullException(nameof(enabled));
        }
    }

    /// <summary>
    /// Contains common functionality for policies which intentionally disrupt async executions returning TResult - which monkey around with calls.
    /// </summary>
    /// <typeparam name="TResult">The type of return values this policy will handle.</typeparam>
    public abstract class AsyncMonkeyPolicy<TResult> : AsyncPolicy<TResult>, IMonkeyPolicy<TResult>
    {
        internal Func<Context, CancellationToken, Task<Double>> InjectionRate { get; }
        internal Func<Context, CancellationToken, Task<bool>> Enabled { get; }

        internal AsyncMonkeyPolicy(Func<Context, CancellationToken, Task<Double>> injectionRate, Func<Context, CancellationToken, Task<bool>> enabled) 
        {
            InjectionRate = injectionRate ?? throw new ArgumentNullException(nameof(injectionRate));
            Enabled = enabled ?? throw new ArgumentNullException(nameof(enabled));
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourOptionsSyntax.cs
================================================
using System;
using Polly.Contrib.Simmy.Behavior;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static AsyncInjectBehaviourPolicy InjectBehaviourAsync(Action<InjectBehaviourAsyncOptions> configureOptions)
        {
            var options = new InjectBehaviourAsyncOptions();
            configureOptions(options);

            if (options.BehaviourInternal == null) throw new ArgumentNullException(nameof(options.BehaviourInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new AsyncInjectBehaviourPolicy(options);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourPolicy.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy.Behavior
{
    /// <summary>
    /// A policy that injects any custom behaviour before the execution of delegates.
    /// </summary>
    public class AsyncInjectBehaviourPolicy : AsyncMonkeyPolicy
    {
        private readonly Func<Context, CancellationToken, Task> _behaviour;

        [Obsolete]
        internal AsyncInjectBehaviourPolicy(Func<Context, CancellationToken, Task> behaviour, Func<Context, CancellationToken, Task<Double>> injectionRate, Func<Context, CancellationToken, Task<bool>> enabled)
            : base(injectionRate, enabled)
        {
            _behaviour = behaviour ?? throw new ArgumentNullException(nameof(behaviour));
        }

        internal AsyncInjectBehaviourPolicy(InjectBehaviourAsyncOptions options)
            : base(options.InjectionRate, options.Enabled)
        {
            _behaviour = options.BehaviourInternal ?? throw new ArgumentNullException(nameof(options.BehaviourInternal));
        }

        /// <inheritdoc/>
        protected override Task<TResult> ImplementationAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken,
            bool continueOnCapturedContext)
        {
            return AsyncMonkeyEngine.InjectBehaviourImplementationAsync(
                action,
                context,
                cancellationToken,
                _behaviour,
                InjectionRate,
                Enabled,
                continueOnCapturedContext);
        }
    }

    /// <summary>
    /// A policy that injects any custom behaviour before the execution of delegates returning <typeparamref name="TResult"/>.
    /// </summary>
    /// <typeparam name="TResult">The type of return values this policy will handle.</typeparam>
    public class AsyncInjectBehaviourPolicy<TResult> : AsyncMonkeyPolicy<TResult>
    {
        private readonly Func<Context, CancellationToken, Task> _behaviour;

        [Obsolete]
        internal AsyncInjectBehaviourPolicy(Func<Context, CancellationToken, Task> behaviour, Func<Context, CancellationToken, Task<Double>> injectionRate, Func<Context, CancellationToken, Task<bool>> enabled)
            : base(injectionRate, enabled)
        {
            _behaviour = behaviour ?? throw new ArgumentNullException(nameof(behaviour));
        }

        internal AsyncInjectBehaviourPolicy(InjectBehaviourAsyncOptions options)
            : base(options.InjectionRate, options.Enabled)
        {
            _behaviour = options.BehaviourInternal ?? throw new ArgumentNullException(nameof(options.BehaviourInternal));
        }

        /// <inheritdoc/>
        protected override Task<TResult> ImplementationAsync(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)
        {
            return AsyncMonkeyEngine.InjectBehaviourImplementationAsync(
                action,
                context,
                cancellationToken,
                _behaviour,
                InjectionRate,
                Enabled,
                continueOnCapturedContext);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourSyntax.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Polly.Contrib.Simmy.Behavior;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed without context</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free mode</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourAsyncOptions> instead.")]
        public static AsyncInjectBehaviourPolicy InjectBehaviourAsync(
            Func<Task> behaviour,
            Double injectionRate,
            Func<Task<bool>> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task BehaviourLambda(Context _, CancellationToken __) => behaviour();
            Task<Double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);
            Task<bool> EnabledLambda(Context _, CancellationToken __) => enabled();

            return InjectBehaviourAsync(BehaviourLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free mode</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourAsyncOptions> instead.")]
        public static AsyncInjectBehaviourPolicy InjectBehaviourAsync(
            Func<Context, CancellationToken, Task> behaviour,
            Double injectionRate,
            Func<Task<bool>> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<Double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);
            Task<bool> EnabledLambda(Context _, CancellationToken __) => enabled();

            return InjectBehaviourAsync(behaviour, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourAsyncOptions> instead.")]
        public static AsyncInjectBehaviourPolicy InjectBehaviourAsync(
            Func<Context, CancellationToken, Task> behaviour,
            Double injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<Double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);

            return InjectBehaviourAsync(behaviour, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourAsyncOptions> instead.")]
        public static AsyncInjectBehaviourPolicy InjectBehaviourAsync(
            Func<Context, CancellationToken, Task> behaviour,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new AsyncInjectBehaviourPolicy(
                    behaviour,
                    injectionRate,
                    enabled);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourTResultOptionsSyntax.cs
================================================
using System;
using Polly.Contrib.Simmy.Behavior;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static AsyncInjectBehaviourPolicy<TResult> InjectBehaviourAsync<TResult>(Action<InjectBehaviourAsyncOptions> configureOptions)
        {
            var options = new InjectBehaviourAsyncOptions();
            configureOptions(options);

            if (options.BehaviourInternal == null) throw new ArgumentNullException(nameof(options.BehaviourInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new AsyncInjectBehaviourPolicy<TResult>(options);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourTResultSyntax.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Polly.Contrib.Simmy.Behavior;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed without context</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free mode</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourAsyncOptions> instead.")]
        public static AsyncInjectBehaviourPolicy<TResult> InjectBehaviourAsync<TResult>(
            Func<Task> behaviour,
            Double injectionRate,
            Func<Task<bool>> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task BehaviourLambda(Context _, CancellationToken __) => behaviour();
            Task<Double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);
            Task<bool> EnabledLambda(Context _, CancellationToken __) => enabled();

            return InjectBehaviourAsync<TResult>(BehaviourLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free mode</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourAsyncOptions> instead.")]
        public static AsyncInjectBehaviourPolicy<TResult> InjectBehaviourAsync<TResult>(
            Func<Context, CancellationToken, Task> behaviour,
            Double injectionRate,
            Func<Task<bool>> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<Double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);
            Task<bool> EnabledLambda(Context _, CancellationToken __) => enabled();

            return InjectBehaviourAsync<TResult>(behaviour, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourAsyncOptions> instead.")]
        public static AsyncInjectBehaviourPolicy<TResult> InjectBehaviourAsync<TResult>(
            Func<Context, CancellationToken, Task> behaviour,
            Double injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<Double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);

            return InjectBehaviourAsync<TResult>(behaviour, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds a <see cref="AsyncInjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourAsyncOptions> instead.")]
        public static AsyncInjectBehaviourPolicy<TResult> InjectBehaviourAsync<TResult>(
            Func<Context, CancellationToken, Task> behaviour,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new AsyncInjectBehaviourPolicy<TResult>(
                    behaviour,
                    injectionRate,
                    enabled);
        }
    }
}

================================================
FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourAsyncOptions.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy.Behavior
{
    /// <summary>
    /// Options used to configure an <see cref="AsyncInjectBehaviourPolicy"/>
    /// </summary>
    public class InjectBehaviourAsyncOptions : InjectOptionsAsyncBase
    {
        /// <summary>
        /// Behaviour Delegate to be executed
        /// </summary>
        internal Func<Context, CancellationToken, Task> BehaviourInternal { get; set; }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourAsyncOptionsExtensions.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy.Behavior
{
    /// <summary>
    /// Allows configuration of behaviour for asynchronous monkey behaviour-injection policies.
    /// </summary>
    public static class InjectBehaviourAsyncOptionsExtensions
    {
        /// <summary>
        /// Configure behaviour to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="behaviour">A delegate representing the behaviour to inject.</param>
        public static InjectBehaviourAsyncOptions Behaviour(this InjectBehaviourAsyncOptions options, Func<Task> behaviour) =>
            Behaviour(options, (_, __) => behaviour());

        /// <summary>
        /// Configure behaviour to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="behaviour">A delegate representing the behaviour to inject.</param>
        public static InjectBehaviourAsyncOptions Behaviour(this InjectBehaviourAsyncOptions options, Func<Context, CancellationToken, Task> behaviour)
        {
            options.BehaviourInternal = behaviour;
            return options;
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourOptions.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy.Behavior
{
    /// <summary>
    /// Options used to configure an <see cref="AsyncInjectBehaviourPolicy"/>
    /// </summary>
    public class InjectBehaviourOptions : InjectOptionsBase
    {
        /// <summary>
        /// Behaviour Delegate to be executed
        /// </summary>
        internal Action<Context, CancellationToken> BehaviourInternal { get; set; }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourOptionsExtensions.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy.Behavior
{
    /// <summary>
    /// Allows configuration of behaviour for synchronous monkey behaviour-injection policies.
    /// </summary>
    public static class InjectBehaviourOptionsExtensions
    {
        /// <summary>
        /// Configure behaviour to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="behaviour">A delegate representing the behaviour to inject.</param>
        public static InjectBehaviourOptions Behaviour(this InjectBehaviourOptions options, Action behaviour) =>
            Behaviour(options, (_, __) => behaviour());

        /// <summary>
        /// Configure behaviour to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="behaviour">A delegate representing the behaviour to inject.</param>
        public static InjectBehaviourOptions Behaviour(this InjectBehaviourOptions options, Action<Context, CancellationToken> behaviour)
        {
            options.BehaviourInternal = behaviour;
            return options;
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourOptionsSyntax.cs
================================================
using System;
using Polly.Contrib.Simmy.Behavior;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static InjectBehaviourPolicy InjectBehaviour(Action<InjectBehaviourOptions> configureOptions)
        {
            var options = new InjectBehaviourOptions();
            configureOptions(options);

            if (options.BehaviourInternal == null) throw new ArgumentNullException(nameof(options.BehaviourInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new InjectBehaviourPolicy(options);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourPolicy.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy.Behavior
{
    /// <summary>
    /// A policy that injects any custom behaviour before the execution of delegates.
    /// </summary>
    public class InjectBehaviourPolicy : Simmy.MonkeyPolicy
    {
        private readonly Action<Context, CancellationToken> _behaviour;

        [Obsolete]
        internal InjectBehaviourPolicy(Action<Context, CancellationToken> behaviour, Func<Context, CancellationToken, double> injectionRate, Func<Context, CancellationToken, bool> enabled) 
            : base(injectionRate, enabled)
        {
            _behaviour = behaviour ?? throw new ArgumentNullException(nameof(behaviour));
        }

        internal InjectBehaviourPolicy(InjectBehaviourOptions options)
            : base(options.InjectionRate, options.Enabled)
        {
            _behaviour = options.BehaviourInternal ?? throw new ArgumentNullException(nameof(options.BehaviourInternal));
        }

        /// <inheritdoc/>
        protected override TResult Implementation<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
        {
            return MonkeyEngine.InjectBehaviourImplementation(
                action,
                context,
                cancellationToken,
                (ctx, ct) => _behaviour(ctx, ct),
                InjectionRate,
                Enabled);
        }
    }
    /// <summary>
    /// A policy that injects any custom behaviour before the execution of delegates returning <typeparamref name="TResult"/>.
    /// </summary>
    /// <typeparam name="TResult">The type of return values this policy will handle.</typeparam>
    public class InjectBehaviourPolicy<TResult> : MonkeyPolicy<TResult>
    {
        private readonly Action<Context, CancellationToken> _behaviour;

        [Obsolete]
        internal InjectBehaviourPolicy(Action<Context, CancellationToken> behaviour, Func<Context, CancellationToken, double> injectionRate, Func<Context, CancellationToken, bool> enabled)
            : base(injectionRate, enabled)
        {
            _behaviour = behaviour ?? throw new ArgumentNullException(nameof(behaviour));
        }

        internal InjectBehaviourPolicy(InjectBehaviourOptions options)
            : base(options.InjectionRate, options.Enabled)
        {
            _behaviour = options.BehaviourInternal ?? throw new ArgumentNullException(nameof(options.BehaviourInternal));
        }

        /// <inheritdoc/>
        protected override TResult Implementation(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
        {
            return MonkeyEngine.InjectBehaviourImplementation(
                action,
                context,
                cancellationToken,
                (ctx, ct) => _behaviour(ctx, ct),
                InjectionRate,
                Enabled);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourSyntax.cs
================================================
using System;
using System.Threading;
using Polly.Contrib.Simmy.Behavior;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed without context</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free mode</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourOptions> instead.")]
        public static InjectBehaviourPolicy InjectBehaviour(
            Action behaviour,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            void BehaviourLambda(Context _, CancellationToken __) => behaviour();
            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;
            bool EnabledLambda(Context _, CancellationToken __) => enabled();

            return InjectBehaviour(BehaviourLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free mode</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourOptions> instead.")]
        public static InjectBehaviourPolicy InjectBehaviour(
            Action<Context, CancellationToken> behaviour,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;
            bool EnabledLambda(Context _, CancellationToken __) => enabled();

            return InjectBehaviour(behaviour, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourOptions> instead.")]
        public static InjectBehaviourPolicy InjectBehaviour(
            Action<Context, CancellationToken> behaviour,
            Double injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;
            return InjectBehaviour(behaviour, (Func<Context, CancellationToken, Double>)InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourOptions> instead.")]
        public static InjectBehaviourPolicy InjectBehaviour(
            Action<Context, CancellationToken> behaviour,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectBehaviourPolicy(
                    behaviour,
                    injectionRate,
                    enabled);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourTResultOptionsSyntax.cs
================================================
using System;
using Polly.Contrib.Simmy.Behavior;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static InjectBehaviourPolicy<TResult> InjectBehaviour<TResult>(Action<InjectBehaviourOptions> configureOptions)
        {
            var options = new InjectBehaviourOptions();
            configureOptions(options);

            if (options.BehaviourInternal == null) throw new ArgumentNullException(nameof(options.BehaviourInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new InjectBehaviourPolicy<TResult>(options);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourTResultSyntax.cs
================================================
using System;
using System.Threading;
using Polly.Contrib.Simmy.Behavior;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed without context</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free mode</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourOptions> instead.")]
        public static InjectBehaviourPolicy<TResult> InjectBehaviour<TResult>(
            Action behaviour,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            void BehaviourLambda(Context _, CancellationToken __) => behaviour();
            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;
            bool EnabledLambda(Context _, CancellationToken __) => enabled();

            return InjectBehaviour<TResult>(BehaviourLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free mode</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourOptions> instead.")]
        public static InjectBehaviourPolicy<TResult> InjectBehaviour<TResult>(
            Action<Context, CancellationToken> behaviour,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;
            bool EnabledLambda(Context _, CancellationToken __) => enabled();

            return InjectBehaviour<TResult>(behaviour, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourOptions> instead.")]
        public static InjectBehaviourPolicy<TResult> InjectBehaviour<TResult>(
            Action<Context, CancellationToken> behaviour,
            Double injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;
            return InjectBehaviour<TResult>(behaviour, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds a <see cref="InjectBehaviourPolicy"/> which executes a behaviour if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="behaviour">Behaviour Delegate to be executed</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectBehaviourOptions> instead.")]
        public static InjectBehaviourPolicy<TResult> InjectBehaviour<TResult>(
            Action<Context, CancellationToken> behaviour,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (behaviour == null) throw new ArgumentNullException(nameof(behaviour));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectBehaviourPolicy<TResult>(
                    behaviour,
                    injectionRate,
                    enabled);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/IMonkeyPolicy.cs
================================================
namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Defines properties and methods common to all Monkey policies.
    /// </summary>
    public interface IMonkeyPolicy : IsPolicy
    {
    }

    /// <summary>
    /// Defines properties and methods common to all Monkey policies generic-typed for executions returning results of type <typeparamref name="TResult"/>.
    /// </summary>
    public interface IMonkeyPolicy<TResult> : IMonkeyPolicy
    {
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/InjectOptionsAsyncBase.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Options used to configure a <see cref="MonkeyPolicy"/>
    /// </summary>
    public abstract class InjectOptionsAsyncBase
    {
        /// <summary>
        /// Lambda to get injection rate between [0, 1]
        /// </summary>
        internal Func<Context, CancellationToken, Task<Double>> InjectionRate { get; set; }

        /// <summary>
        /// Lambda to check if this policy is enabled in current context
        /// </summary>
        internal Func<Context, CancellationToken, Task<bool>> Enabled { get; set; }
    }
}

================================================
FILE: src/Polly.Contrib.Simmy/InjectOptionsAsyncBaseExtensions.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Polly.Contrib.Simmy.Utilities;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Allows configuration of when and how often chaos behaviour is injected, for asynchronous monkey policies.
    /// </summary>
    public static class InjectOptionsAsyncBaseExtensions
    {
        /// <summary>
        /// Configure that this monkey policy is enabled.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        public static InjectOptionsAsyncBase Enabled(this InjectOptionsAsyncBase options) => Enabled(options, true);

        /// <summary>
        /// Configure whether this monkey policy is enabled.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="enabled">A boolean value indicating whether the monkey policy is enabled.</param>
        public static InjectOptionsAsyncBase Enabled(this InjectOptionsAsyncBase options, bool enabled)
        {
            options.Enabled = (_, __) => Task.FromResult(enabled);
            return options;
        }

        /// <summary>
        /// Configure when this monkey policy is enabled.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="enabledWhen">A delegate which can be executed to determine whether the monkey policy should be enabled.</param>
        public static InjectOptionsAsyncBase EnabledWhen(this InjectOptionsAsyncBase options, Func<Context, CancellationToken, Task<bool>> enabledWhen)
        {
            options.Enabled = enabledWhen;
            return options;
        }

        /// <summary>
        /// Configure the rate at which this monkey policy should inject chaos.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        public static InjectOptionsAsyncBase InjectionRate(this InjectOptionsAsyncBase options, Double injectionRate)
        {
            injectionRate.EnsureInjectionThreshold();
            options.InjectionRate = (_, __) => Task.FromResult(injectionRate);
            return options;
        }

        /// <summary>
        /// Configure the rate at which this monkey policy should inject chaos.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="injectionRateProvider">A delegate returning the current rate at which this monkey policy should inject chaos, expressed as double between [0, 1]</param>
        public static InjectOptionsAsyncBase InjectionRate(this InjectOptionsAsyncBase options, Func<Context, CancellationToken, Task<Double>> injectionRateProvider)
        {
            options.InjectionRate = injectionRateProvider;
            return options;
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/InjectOptionsBase.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Options used to configure a <see cref="MonkeyPolicy"/>
    /// </summary>
    public abstract class InjectOptionsBase
    {
        /// <summary>
        /// Lambda to get injection rate between [0, 1]
        /// </summary>
        internal Func<Context, CancellationToken, Double> InjectionRate { get; set; }

        /// <summary>
        /// Lambda to check if this policy is enabled in current context
        /// </summary>
        internal Func<Context, CancellationToken, bool> Enabled { get; set; }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/InjectOptionsBaseExtensions.cs
================================================
using Polly.Contrib.Simmy.Utilities;
using System;
using System.Threading;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Allows configuration of when and how often chaos behaviour is injected, for synchronous monkey policies.
    /// </summary>
    public static class InjectOptionsBaseExtensions
    {
        /// <summary>
        /// Configure that this monkey policy is enabled.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        public static InjectOptionsBase Enabled(this InjectOptionsBase options) => Enabled(options, true);

        /// <summary>
        /// Configure whether this monkey policy is enabled.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="enabled">A boolean value indicating whether the monkey policy is enabled.</param>
        public static InjectOptionsBase Enabled(this InjectOptionsBase options, bool enabled)
        {
            options.Enabled = (_, __) => enabled;
            return options;
        }

        /// <summary>
        /// Configure when this monkey policy is enabled.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="enabledWhen">A delegate which can be executed to determine whether the monkey policy should be enabled.</param>
        public static InjectOptionsBase EnabledWhen(this InjectOptionsBase options, Func<Context, CancellationToken, bool> enabledWhen)
        {
            options.Enabled = enabledWhen;
            return options;
        }

        /// <summary>
        /// Configure the rate at which this monkey policy should inject chaos.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="injectionRate">The injection rate between [0, 1]</param>
        public static InjectOptionsBase InjectionRate(this InjectOptionsBase options, Double injectionRate)
        {
            injectionRate.EnsureInjectionThreshold();
            options.InjectionRate = (_, __) => injectionRate;
            return options;
        }

        /// <summary>
        /// Configure the rate at which this monkey policy should inject chaos.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="injectionRateProvider">A delegate returning the current rate at which this monkey policy should inject chaos, expressed as double between [0, 1]</param>
        public static InjectOptionsBase InjectionRate(this InjectOptionsBase options, Func<Context, CancellationToken, Double> injectionRateProvider)
        {
            options.InjectionRate = injectionRateProvider;
            return options;
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/AsyncInjectLatencyOptionsSyntax.cs
================================================
using System;
using Polly.Contrib.Simmy.Latency;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="AsyncInjectLatencyPolicy"/> which injects latency if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static AsyncInjectLatencyPolicy InjectLatencyAsync(Action<InjectLatencyAsyncOptions> configureOptions)
        {
            var options = new InjectLatencyAsyncOptions();
            configureOptions(options);

            if (options.LatencyInternal == null) throw new ArgumentNullException(nameof(options.LatencyInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new AsyncInjectLatencyPolicy(options);
        }

        /// <summary>
        /// Builds a <see cref="AsyncInjectLatencyPolicy"/> which injects latency if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static AsyncInjectLatencyPolicy<TResult> InjectLatencyAsync<TResult>(Action<InjectLatencyAsyncOptions> configureOptions)
        {
            var options = new InjectLatencyAsyncOptions();
            configureOptions(options);

            if (options.LatencyInternal == null) throw new ArgumentNullException(nameof(options.LatencyInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new AsyncInjectLatencyPolicy<TResult>(options);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/AsyncInjectLatencyPolicy.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Polly.Utilities;

namespace Polly.Contrib.Simmy.Latency
{
    /// <summary>
    /// A policy that injects latency before the execution of delegates.
    /// </summary>
    public class AsyncInjectLatencyPolicy : AsyncMonkeyPolicy
    {
        private readonly Func<Context, CancellationToken, Task<TimeSpan>> _latencyProvider;

        [Obsolete]
        internal AsyncInjectLatencyPolicy(
            Func<Context, CancellationToken, Task<TimeSpan>> latencyProvider,
            Func<Context, CancellationToken, Task<Double>> injectionRate, 
            Func<Context, CancellationToken, Task<bool>> enabled)
            : base(injectionRate, enabled)
        {
            _latencyProvider = latencyProvider ?? throw new ArgumentNullException(nameof(latencyProvider));
        }
        
        internal AsyncInjectLatencyPolicy(InjectLatencyAsyncOptions options)
            : base(options.InjectionRate, options.Enabled)
        {
            _latencyProvider = options.LatencyInternal ?? throw new ArgumentNullException(nameof(options.LatencyInternal));
        }

        /// <inheritdoc/>
        protected override Task<TResult> ImplementationAsync<TResult>(
            Func<Context, CancellationToken, Task<TResult>> action, 
            Context context, 
            CancellationToken cancellationToken,
            bool continueOnCapturedContext)
        {
            return AsyncMonkeyEngine.InjectBehaviourImplementationAsync(
                action,
                context,
                cancellationToken,
                async (ctx, ct) =>
                {
                    var latency = await _latencyProvider(ctx, cancellationToken).ConfigureAwait(continueOnCapturedContext);

                    // to prevent inject latency if token was signaled on latency configuration delegate.
                    cancellationToken.ThrowIfCancellationRequested();
                    await SystemClock.SleepAsync(
                            latency,
                            cancellationToken)
                        .ConfigureAwait(continueOnCapturedContext);
                },
                InjectionRate,
                Enabled,
                continueOnCapturedContext);
        }
    }

    /// <summary>
    /// A policy that injects latency before the execution of delegates.
    /// </summary>
    public class AsyncInjectLatencyPolicy<TResult> : AsyncMonkeyPolicy<TResult>
    {
        private readonly Func<Context, CancellationToken, Task<TimeSpan>> _latencyProvider;

        [Obsolete]
        internal AsyncInjectLatencyPolicy(
            Func<Context, CancellationToken, Task<TimeSpan>> latencyProvider,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
            : base(injectionRate, enabled)
        {
            _latencyProvider = latencyProvider ?? throw new ArgumentNullException(nameof(latencyProvider));
        }

        internal AsyncInjectLatencyPolicy(InjectLatencyAsyncOptions options)
            : base(options.InjectionRate, options.Enabled)
        {
            _latencyProvider = options.LatencyInternal ?? throw new ArgumentNullException(nameof(options.LatencyInternal));
        }

        /// <inheritdoc/>
        protected override Task<TResult> ImplementationAsync(
            Func<Context, CancellationToken, Task<TResult>> action,
            Context context,
            CancellationToken cancellationToken,
            bool continueOnCapturedContext)
        {
            return AsyncMonkeyEngine.InjectBehaviourImplementationAsync(
                action,
                context,
                cancellationToken,
                async (ctx, ct) =>
                {
                    var latency = await _latencyProvider(ctx, cancellationToken).ConfigureAwait(continueOnCapturedContext);

                    // to prevent inject latency if token was signaled on latency configuration delegate.
                    cancellationToken.ThrowIfCancellationRequested();
                    await SystemClock.SleepAsync(
                            latency,
                            cancellationToken)
                        .ConfigureAwait(continueOnCapturedContext);
                },
                InjectionRate,
                Enabled,
                continueOnCapturedContext);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/AsyncInjectLatencySyntax.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Polly.Contrib.Simmy.Latency;

namespace Polly.Contrib.Simmy
{
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds an <see cref="AsyncInjectLatencyPolicy"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">The latency to inject</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyAsyncOptions> instead.")]
        public static AsyncInjectLatencyPolicy InjectLatencyAsync(
            TimeSpan latency,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<TimeSpan> LatencyProvider(Context _, CancellationToken __) => Task.FromResult(latency);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);
            Task<bool> EnabledLambda(Context _, CancellationToken __) => Task.FromResult(enabled());

            return new AsyncInjectLatencyPolicy(LatencyProvider, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectLatencyPolicy"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">The latency to inject</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyAsyncOptions> instead.")]
        public static AsyncInjectLatencyPolicy InjectLatencyAsync(
            TimeSpan latency,
            Double injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<TimeSpan> LatencyProvider(Context _, CancellationToken __) => Task.FromResult(latency);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);

            return new AsyncInjectLatencyPolicy(LatencyProvider, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectLatencyPolicy"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyAsyncOptions> instead.")]
        public static AsyncInjectLatencyPolicy InjectLatencyAsync(
            TimeSpan latency,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<TimeSpan> LatencyProvider(Context _, CancellationToken __) => Task.FromResult(latency);
            return new AsyncInjectLatencyPolicy(LatencyProvider, injectionRate, enabled);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectLatencyPolicy"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyAsyncOptions> instead.")]
        public static AsyncInjectLatencyPolicy InjectLatencyAsync(
            Func<Context, CancellationToken, Task<TimeSpan>> latency,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (latency == null) throw new ArgumentNullException(nameof(latency));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new AsyncInjectLatencyPolicy(latency, injectionRate, enabled);
        }
    }

    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds an <see cref="AsyncInjectLatencyPolicy{TResult}"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyAsyncOptions> instead.")]
        public static AsyncInjectLatencyPolicy<TResult> InjectLatencyAsync<TResult>(
            TimeSpan latency,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<TimeSpan> LatencyProvider(Context _, CancellationToken __) => Task.FromResult(latency);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);
            Task<bool> EnabledLambda(Context _, CancellationToken __) => Task.FromResult(enabled());

            return new AsyncInjectLatencyPolicy<TResult>(LatencyProvider, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectLatencyPolicy{TResult}"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyAsyncOptions> instead.")]
        public static AsyncInjectLatencyPolicy<TResult> InjectLatencyAsync<TResult>(
            TimeSpan latency,
            Double injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<TimeSpan> LatencyProvider(Context _, CancellationToken __) => Task.FromResult(latency);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult(injectionRate);

            return new AsyncInjectLatencyPolicy<TResult>(LatencyProvider, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectLatencyPolicy{TResult}"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyAsyncOptions> instead.")]
        public static AsyncInjectLatencyPolicy<TResult> InjectLatencyAsync<TResult>(
            TimeSpan latency,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<TimeSpan> LatencyProvider(Context _, CancellationToken __) => Task.FromResult(latency);
            return new AsyncInjectLatencyPolicy<TResult>(LatencyProvider, injectionRate, enabled);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectLatencyPolicy{TResult}"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyAsyncOptions> instead.")]
        public static AsyncInjectLatencyPolicy<TResult> InjectLatencyAsync<TResult>(
            Func<Context, CancellationToken, Task<TimeSpan>> latency,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (latency == null) throw new ArgumentNullException(nameof(latency));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new AsyncInjectLatencyPolicy<TResult>(latency, injectionRate, enabled);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyAsyncOptions.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy.Latency
{
    /// <summary>
    /// Options used to configure an <see cref="AsyncInjectLatencyPolicy"/>
    /// </summary>
    public class InjectLatencyAsyncOptions : InjectOptionsAsyncBase
    {
        /// <summary>
        /// Latency Delegate to be executed
        /// </summary>
        internal Func<Context, CancellationToken, Task<TimeSpan>> LatencyInternal { get; set; }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyAsyncOptionsExtensions.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy.Latency
{
    /// <summary>
    /// Allows configuration of behaviour for asynchronous monkey behaviour-injection policies.
    /// </summary>
    public static class InjectLatencyAsyncOptionsExtensions
    {
        /// <summary>
        /// Configure behaviour to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="latency">The latency to inject.</param>
        public static InjectLatencyAsyncOptions Latency(this InjectLatencyAsyncOptions options, TimeSpan latency) =>
            Latency(options, (_, __) => Task.FromResult(latency));

        /// <summary>
        /// Configure behaviour to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="latency">A delegate representing the latency to inject.</param>
        public static InjectLatencyAsyncOptions Latency(this InjectLatencyAsyncOptions options, Func<Context, CancellationToken, Task<TimeSpan>> latency)
        {
            options.LatencyInternal = latency;
            return options;
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyOptions.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy.Latency
{
    /// <summary>
    /// Options used to configure an <see cref="AsyncInjectLatencyPolicy"/>
    /// </summary>
    public class InjectLatencyOptions : InjectOptionsBase
    {
        /// <summary>
        /// Latency Delegate to be executed
        /// </summary>
        internal Func<Context, CancellationToken, TimeSpan> LatencyInternal { get; set; }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyOptionsExtensions.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy.Latency
{
    /// <summary>
    /// Allows configuration of behaviour for asynchronous monkey behaviour-injection policies.
    /// </summary>
    public static class InjectLatencyOptionsExtensions
    {
        /// <summary>
        /// Configure behaviour to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="latency">The latency to inject.</param>
        public static InjectLatencyOptions Latency(this InjectLatencyOptions options, TimeSpan latency) =>
            Latency(options, (_, __) => latency);

        /// <summary>
        /// Configure behaviour to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="latency">A delegate representing the latency to inject.</param>
        public static InjectLatencyOptions Latency(this InjectLatencyOptions options, Func<Context, CancellationToken, TimeSpan> latency)
        {
            options.LatencyInternal = latency;
            return options;
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyOptionsSyntax.cs
================================================
using System;
using Polly.Contrib.Simmy.Latency;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds a <see cref="InjectLatencyPolicy"/> which injects latency if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static InjectLatencyPolicy InjectLatency(Action<InjectLatencyOptions> configureOptions)
        {
            var options = new InjectLatencyOptions();
            configureOptions(options);

            if (options.LatencyInternal == null) throw new ArgumentNullException(nameof(options.LatencyInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new InjectLatencyPolicy(options);
        }

        /// <summary>
        /// Builds a <see cref="AsyncInjectLatencyPolicy"/> which injects latency if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static InjectLatencyPolicy<TResult> InjectLatency<TResult>(Action<InjectLatencyOptions> configureOptions)
        {
            var options = new InjectLatencyOptions();
            configureOptions(options);

            if (options.LatencyInternal == null) throw new ArgumentNullException(nameof(options.LatencyInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new InjectLatencyPolicy<TResult>(options);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyPolicy.cs
================================================
using System;
using System.Threading;
using Polly.Utilities;

namespace Polly.Contrib.Simmy.Latency
{
    /// <summary>
    /// A policy that injects latency before the execution of delegates.
    /// </summary>
    public class InjectLatencyPolicy : MonkeyPolicy
    {
        private readonly Func<Context, CancellationToken, TimeSpan> _latencyProvider;

        [Obsolete]
        internal InjectLatencyPolicy(
            Func<Context, CancellationToken, TimeSpan> latencyProvider,
            Func<Context, CancellationToken, double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
            : base(injectionRate, enabled)
        {
            _latencyProvider = latencyProvider ?? throw new ArgumentNullException(nameof(latencyProvider));
        }

        internal InjectLatencyPolicy(InjectLatencyOptions options)
            : base(options.InjectionRate, options.Enabled)
        {
            _latencyProvider = options.LatencyInternal ?? throw new ArgumentNullException(nameof(options.LatencyInternal));
        }

        /// <inheritdoc/>
        protected override TResult Implementation<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
        {
            return MonkeyEngine.InjectBehaviourImplementation(
                action,
                context,
                cancellationToken,
                (ctx, ct) =>
                {
                    var latency = _latencyProvider(ctx, ct);

                    // to prevent inject latency if token was signaled on latency configuration delegate.
                    cancellationToken.ThrowIfCancellationRequested();
                    SystemClock.Sleep(latency, cancellationToken);
                },
                InjectionRate,
                Enabled);
        }
    }

    /// <summary>
    /// A policy that injects latency before the execution of delegates.
    /// </summary>
    /// <typeparam name="TResult">The type of return values this policy will handle.</typeparam>
    public class InjectLatencyPolicy<TResult> : MonkeyPolicy<TResult>
    {
        private readonly Func<Context, CancellationToken, TimeSpan> _latencyProvider;

        [Obsolete]
        internal InjectLatencyPolicy(
            Func<Context, CancellationToken, TimeSpan> latencyProvider,
            Func<Context, CancellationToken, double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
            : base(injectionRate, enabled)
        {
            _latencyProvider = latencyProvider ?? throw new ArgumentNullException(nameof(latencyProvider));
        }

        internal InjectLatencyPolicy(InjectLatencyOptions options)
            : base(options.InjectionRate, options.Enabled)
        {
            _latencyProvider = options.LatencyInternal ?? throw new ArgumentNullException(nameof(options.LatencyInternal));
        }

        /// <inheritdoc/>
        protected override TResult Implementation(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
        {
            return MonkeyEngine.InjectBehaviourImplementation(
                action,
                context,
                cancellationToken,
                (ctx, ct) =>
                {
                    var latency = _latencyProvider(ctx, ct);

                    // to prevent inject latency if token was signaled on latency configuration delegate.
                    cancellationToken.ThrowIfCancellationRequested();
                    SystemClock.Sleep(latency, cancellationToken);
                },
                InjectionRate,
                Enabled);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencySyntax.cs
================================================
using System;
using System.Threading;
using Polly.Contrib.Simmy.Latency;

namespace Polly.Contrib.Simmy
{
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds an <see cref="InjectLatencyPolicy"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">The latency to inject</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyOptions> instead.")]
        public static InjectLatencyPolicy InjectLatency(
            TimeSpan latency,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectLatencyPolicy((_, __) => latency, (_, __) => injectionRate, (_, __) => enabled());
        }

        /// <summary>
        /// Builds an <see cref="InjectLatencyPolicy"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">The latency to inject</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyOptions> instead.")]
        public static InjectLatencyPolicy InjectLatency(
            TimeSpan latency,
            Double injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectLatencyPolicy((_, __) => latency, (_, __) => injectionRate, enabled);
        }

        /// <summary>
        /// Builds an <see cref="InjectLatencyPolicy"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyOptions> instead.")]
        public static InjectLatencyPolicy InjectLatency(
            TimeSpan latency,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectLatencyPolicy((_, __) => latency, injectionRate, enabled);
        }

        /// <summary>
        /// Builds an <see cref="InjectLatencyPolicy"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyOptions> instead.")]
        public static InjectLatencyPolicy InjectLatency(
            Func<Context, CancellationToken, TimeSpan> latency,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (latency == null) throw new ArgumentNullException(nameof(latency));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectLatencyPolicy(latency, injectionRate, enabled);
        }
    }

    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds an <see cref="InjectLatencyPolicy{TResult}"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyOptions> instead.")]
        public static InjectLatencyPolicy<TResult> InjectLatency<TResult>(
            TimeSpan latency,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectLatencyPolicy<TResult>((_, __) => latency, (_, __) => injectionRate, (_, __) => enabled());
        }

        /// <summary>
        /// Builds an <see cref="InjectLatencyPolicy{TResult}"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyOptions> instead.")]
        public static InjectLatencyPolicy<TResult> InjectLatency<TResult>(
            TimeSpan latency,
            Double injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectLatencyPolicy<TResult>((_, __) => latency, (_, __) => injectionRate, enabled);
        }

        /// <summary>
        /// Builds an <see cref="InjectLatencyPolicy{TResult}"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyOptions> instead.")]
        public static InjectLatencyPolicy<TResult> InjectLatency<TResult>(
            TimeSpan latency,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectLatencyPolicy<TResult>((_, __) => latency, injectionRate, enabled);
        }

        /// <summary>
        /// Builds an <see cref="InjectLatencyPolicy{TResult}"/> which injects latency if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="latency">lambda to get the latency object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectLatencyOptions> instead.")]
        public static InjectLatencyPolicy<TResult> InjectLatency<TResult>(
            Func<Context, CancellationToken, TimeSpan> latency,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (latency == null) throw new ArgumentNullException(nameof(latency));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectLatencyPolicy<TResult>(latency, injectionRate, enabled);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/MonkeyEngine.cs
================================================
using System;
using System.Threading;
using Polly.Contrib.Simmy.Utilities;

namespace Polly.Contrib.Simmy
{
    internal static class MonkeyEngine
    {
        private static bool ShouldInject(Context context, CancellationToken cancellationToken, Func<Context, CancellationToken, double> injectionRate, Func<Context, CancellationToken, bool> enabled)
        {
            // to prevent execute config delegates if token is signaled before to start.
            cancellationToken.ThrowIfCancellationRequested();

            if (!enabled(context, cancellationToken))
            {
                return false;
            }

            // to prevent execute injectionRate config delegate if token is signaled on enable configuration delegate.
            cancellationToken.ThrowIfCancellationRequested();

            double injectionThreshold = injectionRate(context, cancellationToken);

            // to prevent execute further config delegates if token is signaled on injectionRate configuration delegate.
            cancellationToken.ThrowIfCancellationRequested();

            injectionThreshold.EnsureInjectionThreshold();
            return ThreadSafeRandom_LockOncePerThread.NextDouble() < injectionThreshold;
        }

        internal static TResult InjectBehaviourImplementation<TResult>(
            Func<Context, CancellationToken, TResult> action,
            Context context,
            CancellationToken cancellationToken,
            Action<Context, CancellationToken> injectedBehaviour,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (ShouldInject(context, cancellationToken, injectionRate, enabled))
            {
                injectedBehaviour(context, cancellationToken);
            }

            // to prevent execute the user's action if token is signaled on injectedBehaviour delegate.
            cancellationToken.ThrowIfCancellationRequested();
            return action(context, cancellationToken);
        }

        internal static TResult InjectExceptionImplementation<TResult>(
            Func<Context, CancellationToken, TResult> action,
            Context context,
            CancellationToken cancellationToken,
            Func<Context, CancellationToken, Exception> injectedException,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (ShouldInject(context, cancellationToken, injectionRate, enabled))
            {
                Exception exception = injectedException(context, cancellationToken);

                // to prevent throws the exception if token is signaled on injectedException configuration delegate.
                cancellationToken.ThrowIfCancellationRequested();

                if (exception != null)
                {
                    throw exception;
                }
            }

            return action(context, cancellationToken);
        }

        internal static TResult InjectResultImplementation<TResult>(
            Func<Context, CancellationToken, TResult> action,
            Context context,
            CancellationToken cancellationToken,
            Func<Context, CancellationToken, TResult> injectedResult,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (ShouldInject(context, cancellationToken, injectionRate, enabled))
            {
                return injectedResult(context, cancellationToken);
            }

            // to prevent inject the result if token is signaled on injectedResult delegate.
            cancellationToken.ThrowIfCancellationRequested();
            return action(context, cancellationToken);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/MonkeyPolicy.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Contains common functionality for policies which intentionally disrupt sync executions - which monkey around with calls.
    /// </summary>
    public abstract partial class MonkeyPolicy : Policy, IMonkeyPolicy
    {
        internal Func<Context, CancellationToken, Double> InjectionRate { get; }

        internal Func<Context, CancellationToken, bool> Enabled { get; }

        internal MonkeyPolicy(Func<Context, CancellationToken, Double> injectionRate, Func<Context, CancellationToken, bool> enabled)
        {
            InjectionRate = injectionRate ?? throw new ArgumentNullException(nameof(injectionRate));
            Enabled = enabled ?? throw new ArgumentNullException(nameof(enabled));
        }
    }

    /// <summary>
    /// Contains common functionality for policies which intentionally disrupt sync executions returning TResult - which monkey around with calls.
    /// </summary>
    /// <typeparam name="TResult">The type of return values this policy will handle.</typeparam>
    public abstract class MonkeyPolicy<TResult> : Policy<TResult>, IMonkeyPolicy<TResult>
    {
        internal Func<Context, CancellationToken, Double> InjectionRate { get; }

        internal Func<Context, CancellationToken, bool> Enabled { get; }

        internal MonkeyPolicy(Func<Context, CancellationToken, Double> injectionRate, Func<Context, CancellationToken, bool> enabled)
        {
            InjectionRate = injectionRate ?? throw new ArgumentNullException(nameof(injectionRate));
            Enabled = enabled ?? throw new ArgumentNullException(nameof(enabled));
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/AsyncInjectOutcomeOptionsSyntax.cs
================================================
using System;
using Polly.Contrib.Simmy.Outcomes;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy"/> which injects a fault if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static AsyncInjectOutcomePolicy InjectExceptionAsync(Action<InjectOutcomeAsyncOptions<Exception>> configureOptions)
        {
            var options = new InjectOutcomeAsyncOptions<Exception>();
            configureOptions(options);

            if (options.Outcome == null) throw new ArgumentNullException(nameof(options.Outcome));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new AsyncInjectOutcomePolicy(options);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy"/> which injects a result if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static AsyncInjectOutcomePolicy<TResult> InjectResultAsync<TResult>(Action<InjectOutcomeAsyncOptions<TResult>> configureOptions)
        {
            var options = new InjectOutcomeAsyncOptions<TResult>();
            configureOptions(options);

            if (options.Outcome == null) throw new ArgumentNullException(nameof(options.Outcome));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new AsyncInjectOutcomePolicy<TResult>(options);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy"/> which injects a fault as result if  <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static AsyncInjectOutcomePolicy<TResult> InjectResultAsync<TResult>(Action<InjectOutcomeAsyncOptions<Exception>> configureOptions)
        {
            var options = new InjectOutcomeAsyncOptions<Exception>();
            configureOptions(options);

            if (options.Outcome == null) throw new ArgumentNullException(nameof(options.Outcome));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new AsyncInjectOutcomePolicy<TResult>(options);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/AsyncInjectOutcomePolicy.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy.Outcomes
{
    /// <summary>
    /// A policy that throws an exception in place of executing the passed delegate.
    /// <remarks>The policy can also be configured to return null in place of the exception, to explicitly fake that no exception is thrown.</remarks>
    /// </summary>
    public class AsyncInjectOutcomePolicy : AsyncMonkeyPolicy
    {
        private readonly Func<Context, CancellationToken, Task<Exception>> _faultProvider;

        [Obsolete]
        internal AsyncInjectOutcomePolicy(Func<Context, CancellationToken, Task<Exception>> faultProvider, Func<Context, CancellationToken, Task<Double>> injectionRate, Func<Context, CancellationToken, Task<bool>> enabled)
            : base(injectionRate, enabled)
        {
            _faultProvider = faultProvider ?? throw new ArgumentNullException(nameof(faultProvider));
        }
        
        internal AsyncInjectOutcomePolicy(InjectOutcomeAsyncOptions<Exception> options)
            : base(options.InjectionRate, options.Enabled)
        {
            _faultProvider = options.Outcome ?? throw new ArgumentNullException(nameof(options.Outcome));
        }

        /// <inheritdoc/>
        protected override Task<TResult> ImplementationAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken,
            bool continueOnCapturedContext)
        {
             return AsyncMonkeyEngine.InjectExceptionImplementationAsync(
                action,
                context,
                cancellationToken,
                _faultProvider,
                InjectionRate,
                Enabled,
                continueOnCapturedContext);
        }
    }

    /// <summary>
    /// A policy that injects an outcome (throws an exception or returns a specific result), in place of executing the passed delegate.
    /// </summary>
    public class AsyncInjectOutcomePolicy<TResult> : AsyncMonkeyPolicy<TResult>
    {
        private readonly Func<Context, CancellationToken, Task<Exception>> _faultProvider;
        private readonly Func<Context, CancellationToken, Task<TResult>> _resultProvider;

        [Obsolete]
        internal AsyncInjectOutcomePolicy(Func<Context, CancellationToken, Task<Exception>> faultProvider, Func<Context, CancellationToken, Task<Double>> injectionRate, Func<Context, CancellationToken, Task<bool>> enabled)
            : base(injectionRate, enabled)
        {
            _faultProvider = faultProvider ?? throw new ArgumentNullException(nameof(faultProvider));
        }

        [Obsolete]
        internal AsyncInjectOutcomePolicy(Func<Context, CancellationToken, Task<TResult>> resultProvider, Func<Context, CancellationToken, Task<Double>> injectionRate, Func<Context, CancellationToken, Task<bool>> enabled)
            : base(injectionRate, enabled)
        {
            _resultProvider = resultProvider ?? throw new ArgumentNullException(nameof(resultProvider));
        }

        internal AsyncInjectOutcomePolicy(InjectOutcomeAsyncOptions<Exception> options)
            : base(options.InjectionRate, options.Enabled)
        {
            _faultProvider = options.Outcome ?? throw new ArgumentNullException(nameof(options.Outcome));
        }

        internal AsyncInjectOutcomePolicy(InjectOutcomeAsyncOptions<TResult> options)
            : base(options.InjectionRate, options.Enabled)
        {
            _resultProvider = options.Outcome ?? throw new ArgumentNullException(nameof(options.Outcome));
        }

        /// <inheritdoc/>
        protected override async Task<TResult> ImplementationAsync(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken,
            bool continueOnCapturedContext)
        {
            if (_faultProvider != null)
            {
                return await AsyncMonkeyEngine.InjectExceptionImplementationAsync(
                    action,
                    context,
                    cancellationToken,
                    _faultProvider,
                    InjectionRate,
                    Enabled,
                    continueOnCapturedContext);
            }
            else if (_resultProvider != null)
            {
                return await AsyncMonkeyEngine.InjectResultImplementationAsync(
                    action,
                    context,
                    cancellationToken,
                    _resultProvider,
                    InjectionRate,
                    Enabled,
                    continueOnCapturedContext);
            }
            else
            {
                throw new InvalidOperationException("Either a fault or fake result to inject must be defined.");
            }
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/AsyncInjectOutcomeSyntax.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Polly.Contrib.Simmy.Outcomes;

namespace Polly.Contrib.Simmy
{
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultAsyncOptions> instead.")]
        public static AsyncInjectOutcomePolicy InjectFaultAsync(
            Exception fault,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<Exception> FaultLambda(Context _, CancellationToken __) => Task.FromResult<Exception>(fault);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult<Double>(injectionRate);
            Task<bool> EnabledLambda(Context _, CancellationToken __) => Task.FromResult<bool>(enabled());

            return new AsyncInjectOutcomePolicy(FaultLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultAsyncOptions> instead.")]
        public static AsyncInjectOutcomePolicy InjectFaultAsync(
            Exception fault,
            Double injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<Exception> FaultLambda(Context _, CancellationToken __) => Task.FromResult<Exception>(fault);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult<Double>(injectionRate);

            return new AsyncInjectOutcomePolicy(FaultLambda, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="faultProvider">lambda to get the fault exception object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultAsyncOptions> instead.")]
        public static AsyncInjectOutcomePolicy InjectFaultAsync(
            Func<Context, CancellationToken, Task<Exception>> faultProvider,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (faultProvider == null) throw new ArgumentNullException(nameof(faultProvider));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));
            
            return new AsyncInjectOutcomePolicy(faultProvider, injectionRate, enabled);
        }
    }

    public partial class MonkeyPolicy
    {
        #region Exception Based Faults
        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy{TResult}"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultAsyncOptions> instead.")]
        public static AsyncInjectOutcomePolicy<TResult> InjectFaultAsync<TResult>(
            Exception fault,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<Exception> FaultLambda(Context _, CancellationToken __) => Task.FromResult<Exception>(fault);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult<Double>(injectionRate);
            Task<bool> EnabledLambda(Context _, CancellationToken __) => Task.FromResult<bool>(enabled());

            return new AsyncInjectOutcomePolicy<TResult>((Func<Context, CancellationToken, Task<Exception>>)FaultLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy{TResult}"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultAsyncOptions> instead.")]
        public static AsyncInjectOutcomePolicy<TResult> InjectFaultAsync<TResult>(
            Exception fault,
            Double injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<Exception> FaultLambda(Context _, CancellationToken __) => Task.FromResult<Exception>(fault);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult<Double>(injectionRate);

            return new AsyncInjectOutcomePolicy<TResult>((Func<Context, CancellationToken, Task<Exception>>)FaultLambda, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy{TResult}"/> which executes a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="faultProvider">lambda to get the fault exception object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultAsyncOptions> instead.")]
        public static AsyncInjectOutcomePolicy<TResult> InjectFaultAsync<TResult>(
            Func<Context, CancellationToken, Task<Exception>> faultProvider,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (faultProvider == null) throw new ArgumentNullException(nameof(faultProvider));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));
            
            return new AsyncInjectOutcomePolicy<TResult>(faultProvider, injectionRate, enabled);
        }
        #endregion

        #region TResult based Faults

        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy{TResult}"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultAsyncOptions> instead.")]
        public static AsyncInjectOutcomePolicy<TResult> InjectFaultAsync<TResult>(
            TResult fault,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<TResult> FaultLambda(Context _, CancellationToken __) => Task.FromResult<TResult>(fault);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult<Double>(injectionRate);
            Task<bool> EnabledLambda(Context _, CancellationToken __)
            {
                return Task.FromResult<bool>(enabled());
            }

            return new AsyncInjectOutcomePolicy<TResult>((Func<Context, CancellationToken, Task<TResult>>)FaultLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy{TResult}"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultAsyncOptions> instead.")]
        public static AsyncInjectOutcomePolicy<TResult> InjectFaultAsync<TResult>(
            TResult fault,
            Double injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Task<TResult> FaultLambda(Context _, CancellationToken __) => Task.FromResult<TResult>(fault);
            Task<double> InjectionRateLambda(Context _, CancellationToken __) => Task.FromResult<Double>(injectionRate);

            return new AsyncInjectOutcomePolicy<TResult>((Func<Context, CancellationToken, Task<TResult>>)FaultLambda, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds an <see cref="AsyncInjectOutcomePolicy{TResult}"/> which executes a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">lambda to get the fault exception object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultAsyncOptions> instead.")]
        public static AsyncInjectOutcomePolicy<TResult> InjectFaultAsync<TResult>(
            Func<Context, CancellationToken, Task<TResult>> fault,
            Func<Context, CancellationToken, Task<Double>> injectionRate,
            Func<Context, CancellationToken, Task<bool>> enabled)
        {
            if (fault == null) throw new ArgumentNullException(nameof(fault));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new AsyncInjectOutcomePolicy<TResult>(fault, injectionRate, enabled);
        }
        #endregion
    }
}

================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeAsyncOptions.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy.Outcomes
{
    /// <summary>
    /// Options used to configure an <see cref="InjectOutcomePolicy"/>
    /// </summary>
    public class InjectOutcomeAsyncOptions<TResult> : InjectOptionsAsyncBase
    {
        /// <summary>
        /// Outcome Delegate to be executed
        /// </summary>
        internal Func<Context, CancellationToken, Task<TResult>> Outcome { get; set; }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeAsyncOptionsExtensions.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Polly.Contrib.Simmy.Outcomes
{
    /// <summary>
    /// Allows configuration of fault for asynchronous monkey fault-injection policies.
    /// </summary>
    public static class InjectOutcomeAsyncOptionsExtensions
    {
        /// <summary>
        /// Configure fault to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="fault">The exception to inject.</param>
        public static InjectOutcomeAsyncOptions<Exception> Fault(this InjectOutcomeAsyncOptions<Exception> options, Exception fault)
            => Fault(options, (_, __) => Task.FromResult(fault));

        /// <summary>
        /// Configure fault to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="fault">A delegate representing the fault to inject.</param>
        public static InjectOutcomeAsyncOptions<Exception> Fault(this InjectOutcomeAsyncOptions<Exception> options, Func<Context, CancellationToken, Task<Exception>> fault)
        {
            options.Outcome = fault;
            return options;
        }

        /// <summary>
        /// Configure fault to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="fault">The result to inject</param>
        public static InjectOutcomeAsyncOptions<Exception> Fault<TResult>(this InjectOutcomeAsyncOptions<Exception> options, Exception fault) =>
            Fault<TResult>(options, (_, __) => Task.FromResult(fault));

        /// <summary>
        /// Configure fault to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="fault">A delegate representing the result to inject.</param>
        public static InjectOutcomeAsyncOptions<Exception> Fault<TResult>(this InjectOutcomeAsyncOptions<Exception> options, Func<Context, CancellationToken, Task<Exception>> fault)
        {
            options.Outcome = fault;
            return options;
        }

        /// <summary>
        /// Configure result to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="result">The result to inject</param>
        public static InjectOutcomeAsyncOptions<TResult> Result<TResult>(this InjectOutcomeAsyncOptions<TResult> options, TResult result) =>
            Result(options, (_, __) => Task.FromResult(result));

        /// <summary>
        /// Configure result to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="result">A delegate representing the result to inject.</param>
        public static InjectOutcomeAsyncOptions<TResult> Result<TResult>(this InjectOutcomeAsyncOptions<TResult> options, Func<Context, CancellationToken, Task<TResult>> result)
        {
            options.Outcome = result;
            return options;
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeOptions.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy.Outcomes
{
    /// <summary>
    /// Options used to configure an <see cref="InjectOutcomePolicy"/>
    /// </summary>
    public class InjectOutcomeOptions<TResult> : InjectOptionsBase
    {
        /// <summary>
        /// Outcome Delegate to be executed
        /// </summary>
        internal Func<Context, CancellationToken, TResult> OutcomeInternal { get; set; }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeOptionsExtensions.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy.Outcomes
{
    /// <summary>
    /// Allows configuration of fault for synchronous monkey fault-injection policies.
    /// </summary>
    public static class InjectOutcomeOptionsExtensions
    {
        /// <summary>
        /// Configure fault to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="fault">The exception to inject.</param>
        public static InjectOutcomeOptions<Exception> Fault(this InjectOutcomeOptions<Exception> options, Exception fault)
            => Fault(options, (_, __) => fault);

        /// <summary>
        /// Configure fault to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="fault">A delegate representing the fault to inject.</param>
        public static InjectOutcomeOptions<Exception> Fault(this InjectOutcomeOptions<Exception> options, Func<Context, CancellationToken, Exception> fault)
        {
            options.OutcomeInternal = fault;
            return options;
        }

        /// <summary>
        /// Configure fault to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="fault">The result to inject</param>
        public static InjectOutcomeOptions<Exception> Fault<TResult>(this InjectOutcomeOptions<Exception> options, Exception fault) =>
            Fault<TResult>(options, (_, __) => fault);

        /// <summary>
        /// Configure fault to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="fault">A delegate representing the result to inject.</param>
        public static InjectOutcomeOptions<Exception> Fault<TResult>(this InjectOutcomeOptions<Exception> options, Func<Context, CancellationToken, Exception> fault)
        {
            options.OutcomeInternal = fault;
            return options;
        }

        /// <summary>
        /// Configure result to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="result">The result to inject</param>
        public static InjectOutcomeOptions<TResult> Result<TResult>(this InjectOutcomeOptions<TResult> options, TResult result) =>
            Result(options, (_, __) => result);

        /// <summary>
        /// Configure result to inject with the monkey policy.
        /// </summary>
        /// <param name="options">The configuration object.</param>
        /// <param name="result">A delegate representing the result to inject.</param>
        public static InjectOutcomeOptions<TResult> Result<TResult>(this InjectOutcomeOptions<TResult> options, Func<Context, CancellationToken, TResult> result)
        {
            options.OutcomeInternal = result;
            return options;
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeOptionsSyntax.cs
================================================
using System;
using Polly.Contrib.Simmy.Outcomes;

namespace Polly.Contrib.Simmy
{
    /// <summary>
    /// Fluent API for defining Monkey <see cref="Policy"/>. 
    /// </summary>
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a fault if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static InjectOutcomePolicy InjectException(Action<InjectOutcomeOptions<Exception>> configureOptions)
        {
            var options = new InjectOutcomeOptions<Exception>();
            configureOptions(options);

            if (options.OutcomeInternal == null) throw new ArgumentNullException(nameof(options.OutcomeInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new InjectOutcomePolicy(options);
        }

        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a result if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static InjectOutcomePolicy<TResult> InjectResult<TResult>(Action<InjectOutcomeOptions<TResult>> configureOptions)
        {
            var options = new InjectOutcomeOptions<TResult>();
            configureOptions(options);

            if (options.OutcomeInternal == null) throw new ArgumentNullException(nameof(options.OutcomeInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new InjectOutcomePolicy<TResult>(options);
        }

        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a fault as result if <paramref name="configureOptions.Enabled"/> returns true and
        /// a random number is within range of <paramref name="configureOptions.InjectionRate"/>.
        /// </summary>
        /// <param name="configureOptions">A callback to configure policy options.</param>
        /// <returns>The policy instance.</returns>
        public static InjectOutcomePolicy<TResult> InjectResult<TResult>(Action<InjectOutcomeOptions<Exception>> configureOptions)
        {
            var options = new InjectOutcomeOptions<Exception>();
            configureOptions(options);

            if (options.OutcomeInternal == null) throw new ArgumentNullException(nameof(options.OutcomeInternal));
            if (options.InjectionRate == null) throw new ArgumentNullException(nameof(options.InjectionRate));
            if (options.Enabled == null) throw new ArgumentNullException(nameof(options.Enabled));

            return new InjectOutcomePolicy<TResult>(options);
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomePolicy.cs
================================================
using System;
using System.Threading;

namespace Polly.Contrib.Simmy.Outcomes
{
    /// <summary>
    /// A policy that throws an exception in place of executing the passed delegate.
    /// <remarks>The policy can also be configured to return null in place of the exception, to explicitly fake that no exception is thrown.</remarks>
    /// </summary>
    public class InjectOutcomePolicy : MonkeyPolicy
    {
        private readonly Func<Context, CancellationToken, Exception> _faultProvider;

        [Obsolete]
        internal InjectOutcomePolicy(Func<Context, CancellationToken, Exception> faultProvider, Func<Context, CancellationToken, double> injectionRate, Func<Context, CancellationToken, bool> enabled) 
            : base(injectionRate, enabled)
        {
            _faultProvider = faultProvider ?? throw new ArgumentNullException(nameof(faultProvider));
        }

        internal InjectOutcomePolicy(InjectOutcomeOptions<Exception> options)
            : base(options.InjectionRate, options.Enabled)
        {
            _faultProvider = options.OutcomeInternal ?? throw new ArgumentNullException(nameof(options.OutcomeInternal));
        }

        /// <inheritdoc/>
        protected override TResult Implementation<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
        {
            return MonkeyEngine.InjectExceptionImplementation(
                action,
                context,
                cancellationToken,
                _faultProvider,
                InjectionRate,
                Enabled);
        }
    }

    /// <summary>
    /// A policy that injects an outcome (throws an exception or returns a specific result), in place of executing the passed delegate.
    /// </summary>
    public class InjectOutcomePolicy<TResult> : MonkeyPolicy<TResult>
    {
        private readonly Func<Context, CancellationToken, Exception> _faultProvider;
        private readonly Func<Context, CancellationToken, TResult> _resultProvider;

        [Obsolete]
        internal InjectOutcomePolicy(Func<Context, CancellationToken, Exception> faultProvider, Func<Context, CancellationToken, double> injectionRate, Func<Context, CancellationToken, bool> enabled)
            : base(injectionRate, enabled)
        {
            _faultProvider = faultProvider ?? throw new ArgumentNullException(nameof(faultProvider));
        }

        [Obsolete]
        internal InjectOutcomePolicy(Func<Context, CancellationToken, TResult> resultProvider, Func<Context, CancellationToken, double> injectionRate, Func<Context, CancellationToken, bool> enabled)
            : base(injectionRate, enabled)
        {
            _resultProvider = resultProvider ?? throw new ArgumentNullException(nameof(resultProvider));
        }

        internal InjectOutcomePolicy(InjectOutcomeOptions<Exception> options)
            : base(options.InjectionRate, options.Enabled)
        {
            _faultProvider = options.OutcomeInternal ?? throw new ArgumentNullException(nameof(options.OutcomeInternal));
        }

        internal InjectOutcomePolicy(InjectOutcomeOptions<TResult> options)
            : base(options.InjectionRate, options.Enabled)
        {
            _resultProvider = options.OutcomeInternal ?? throw new ArgumentNullException(nameof(options.OutcomeInternal));
        }

        /// <inheritdoc/>
        protected override TResult Implementation(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
        {
            if (_faultProvider != null)
            {
                return MonkeyEngine.InjectExceptionImplementation(
                    action,
                    context,
                    cancellationToken,
                    _faultProvider,
                    InjectionRate,
                    Enabled);
            }
            else if (_resultProvider != null)
            {
                return MonkeyEngine.InjectResultImplementation(
                    action,
                    context,
                    cancellationToken,
                    _resultProvider,
                    InjectionRate,
                    Enabled);
            }
            else
            {
                throw new InvalidOperationException("Either a fault or fake result to inject must be defined.");
            }
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeSyntax.cs
================================================
using System;
using System.Threading;
using Polly.Contrib.Simmy.Outcomes;

namespace Polly.Contrib.Simmy
{
    public partial class MonkeyPolicy
    {
        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultOptions> instead.")]
        public static InjectOutcomePolicy InjectFault(
            Exception fault,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Exception FaultLambda(Context _, CancellationToken __) => fault;
            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;
            bool EnabledLambda(Context _, CancellationToken __) => enabled();

            return new InjectOutcomePolicy(FaultLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultOptions> instead.")]
        public static InjectOutcomePolicy InjectFault(
            Exception fault,
            Double injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Exception FaultLambda(Context _, CancellationToken __) => fault;
            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;

            return new InjectOutcomePolicy(FaultLambda, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="faultProvider">lambda to get the fault exception object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultOptions> instead.")]
        public static InjectOutcomePolicy InjectFault(
            Func<Context, CancellationToken, Exception> faultProvider,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (faultProvider == null) throw new ArgumentNullException(nameof(faultProvider));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectOutcomePolicy(faultProvider, injectionRate, enabled);
        }
    }

    public partial class MonkeyPolicy
    {
        #region Exception Based Faults
        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultOptions> instead.")]
        public static InjectOutcomePolicy<TResult> InjectFault<TResult>(
            Exception fault,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Exception FaultLambda(Context _, CancellationToken __) => fault;
            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;
            bool EnabledLambda(Context _, CancellationToken __) => enabled();

            return new InjectOutcomePolicy<TResult>((Func<Context, CancellationToken, Exception>)FaultLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault exception object to throw</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultOptions> instead.")]
        public static InjectOutcomePolicy<TResult> InjectFault<TResult>(
            Exception fault,
            Double injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            Exception FaultLambda(Context _, CancellationToken __) => fault;
            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;

            return new InjectOutcomePolicy<TResult>((Func<Context, CancellationToken, Exception>)FaultLambda, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which executes a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="faultProvider">lambda to get the fault exception object</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultOptions> instead.")]
        public static InjectOutcomePolicy<TResult> InjectFault<TResult>(
            Func<Context, CancellationToken, Exception> faultProvider,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (faultProvider == null) throw new ArgumentNullException(nameof(faultProvider));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectOutcomePolicy<TResult>(faultProvider, injectionRate, enabled);
        }

        #endregion

        #region TResult Based Faults

        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault result object to inject</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in context free fashion</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultOptions> instead.")]
        public static InjectOutcomePolicy<TResult> InjectFault<TResult>(
            TResult fault,
            Double injectionRate,
            Func<bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            TResult FaultLambda(Context _, CancellationToken __) => fault;
            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;
            bool EnabledLambda(Context _, CancellationToken __) => enabled();

            return new InjectOutcomePolicy<TResult>((Func<Context, CancellationToken, TResult>)FaultLambda, InjectionRateLambda, EnabledLambda);
        }

        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which injects a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="fault">The fault result object to inject</param>
        /// <param name="injectionRate">injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultOptions> instead.")]
        public static InjectOutcomePolicy<TResult> InjectFault<TResult>(
            TResult fault,
            Double injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            TResult FaultLambda(Context _, CancellationToken __) => fault;
            double InjectionRateLambda(Context _, CancellationToken __) => injectionRate;

            return new InjectOutcomePolicy<TResult>((Func<Context, CancellationToken, TResult>)FaultLambda, InjectionRateLambda, enabled);
        }

        /// <summary>
        /// Builds an <see cref="InjectOutcomePolicy"/> which executes a fault if <paramref name="enabled"/> returns true and
        /// a random number is within range of <paramref name="injectionRate"/>.
        /// </summary>
        /// <param name="faultProvider">The fault result object to inject</param>
        /// <param name="injectionRate">lambda to get injection rate between [0, 1]</param>
        /// <param name="enabled">Lambda to check if this policy is enabled in current context</param>
        /// <returns>The policy instance.</returns>
        [Obsolete("This overload is going to be deprecated, use the overload which takes Action<InjectFaultOptions> instead.")]
        public static InjectOutcomePolicy<TResult> InjectFault<TResult>(
            Func<Context, CancellationToken, TResult> faultProvider,
            Func<Context, CancellationToken, Double> injectionRate,
            Func<Context, CancellationToken, bool> enabled)
        {
            if (faultProvider == null) throw new ArgumentNullException(nameof(faultProvider));
            if (injectionRate == null) throw new ArgumentNullException(nameof(injectionRate));
            if (enabled == null) throw new ArgumentNullException(nameof(enabled));

            return new InjectOutcomePolicy<TResult>(faultProvider, injectionRate, enabled);
        }

        #endregion
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Polly.Contrib.Simmy.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>netstandard1.1;netstandard2.0;netstandard2.1</TargetFrameworks>
    <AssemblyName>Polly.Contrib.Simmy</AssemblyName>
    <RootNamespace>Polly.Contrib.Simmy</RootNamespace>
    <Version>0.1.0</Version>
    <AssemblyVersion>0.0.0.0</AssemblyVersion>
    <FileVersion>0.1.0.0</FileVersion>
    <InformationalVersion>0.1.0.0</InformationalVersion>
    <PackageVersion>0.1.0</PackageVersion>
    <Company>App vNext</Company>
    <Copyright>Copyright (c) 2019, App vNext</Copyright>
    <Description>Simmy is a chaos-engineering and fault-injection tool, integrating with the Polly resilience project for .NET</Description>
    <DefaultLanguage>en-US</DefaultLanguage>
    <GenerateAssemblyInfo>true</GenerateAssemblyInfo>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <Authors>App vNext</Authors>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugType>full</DebugType>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' ">
    <NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
  </PropertyGroup>
  <ItemGroup>
    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
      <_Parameter1>Simmy.Specs</_Parameter1>
    </AssemblyAttribute>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Polly" Version="7.1.0" />
  </ItemGroup>
</Project>


================================================
FILE: src/Polly.Contrib.Simmy/Utilities/GuardExtensions.cs
================================================
using System;

namespace Polly.Contrib.Simmy.Utilities
{
    internal static class GuardExtensions
    {
        public static void EnsureInjectionThreshold(this double injectionThreshold)
        {
            if (injectionThreshold < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(injectionThreshold), "Injection rate/threshold in Monkey policies should always be a double between [0, 1]; never a negative number.");
            }
            if (injectionThreshold > 1)
            {
                throw new ArgumentOutOfRangeException(nameof(injectionThreshold), "Injection rate/threshold in Monkey policies should always be a double between [0, 1]; never a number greater than 1.");
            }
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy/Utilities/ThreadSafeRandom_LockOncePerThread.cs
================================================
using System;
using System.Threading;

// Note: Given the current .NET Core (2.1) and .NET Framework (4.7.2) implementations of Random, 
// this implementation intentionally sacrifices a (marginal) degree of randomness in favour of speed, by locking only once-per-thread.
// An implementation locking once-per-random-number-generated will generate a marginally more random sequence.
// This implementation intentionally favours execution speed over that marginal extra degree of randomness.
// We choose that trade-off where the random number generator is used to select executions for chaos/fault injection, where we want minimum extra drag per execution.
// In other scenarios such as randomizing for jitter in retries, the Polly project may (with a different implementation) favour randomness at the expense of locking once-per-random-number-generated.

// References:
// - https://stackoverflow.com/a/25448166/
// - https://docs.microsoft.com/en-us/dotnet/api/system.random?view=netframework-4.7.2#the-systemrandom-class-and-thread-safety
// - https://stackoverflow.com/questions/25390301/
// - https://github.com/App-vNext/Polly/issues/530#issuecomment-439680613

namespace Polly.Contrib.Simmy.Utilities
{
    /// <summary>
    /// An implementation of a Random Number Generator that is thread-safe for generating random numbers concurrently on multiple threads.
    /// <remarks>Thread-safety without locking-per-random-number-generated is achieved simply by storing and using a ThreadStatic instance of <see cref="Random"/> per thread.</remarks>
    /// </summary>
    public class ThreadSafeRandom_LockOncePerThread
    {
        /// <summary>
        /// Initializes the static <see cref="ThreadSafeRandom_LockOncePerThread"/>, setting the <see cref="NextDouble"/> method to a thread-safe implementation which locks only once-per-thread.
        /// </summary>
        static ThreadSafeRandom_LockOncePerThread()
        {
            Reset();
        }

        private static readonly Random s_globalRandom = new Random();

        private static readonly ThreadLocal<Random> t_threadRandom = new ThreadLocal<Random>(InitializeThreadRandom);

        private static Random InitializeThreadRandom()
        {
            int seed;
            // We must lock minimally once-per-thread. If the instance s_globalRandom is accessed on multiple threads concurrently, 
            // the current .NET Framework and .NET Core implementations of Random have a liability to return sequences of zeros.
            // See the articles referenced at the head of this class.
            lock (s_globalRandom)
            {
                seed = s_globalRandom.Next();
            }

            return new Random(seed);
        }

        /// <summary>
        /// Returns a random floating point number that is greater than or equal to 0.0, and less than 1.0.
        /// </summary>
        public static Func<double> NextDouble;

        /// <summary>
        /// Method to reset the random generator.
        /// </summary>
        public static void Reset()
        {
            NextDouble = () => t_threadRandom.Value.NextDouble();
        }
    }
}


================================================
FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourAsyncSpecs.cs
================================================
using System;
using System.Threading.Tasks;
using FluentAssertions;
using Polly.Contrib.Simmy.Utilities;
using Xunit;

namespace Polly.Contrib.Simmy.Specs.Behavior
{
    [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    [Obsolete]
    public class InjectBehaviourAsyncSpecs : IDisposable
    {
        public InjectBehaviourAsyncSpecs()
        {
            ThreadSafeRandom_LockOncePerThread.NextDouble = () => 0.5;
        }

        public void Dispose()
        {
            ThreadSafeRandom_LockOncePerThread.Reset();
        }

        [Fact]
        public void Given_not_enabled_should_not_inject_behaviour()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExecuted = false;

            var policy = MonkeyPolicy.InjectBehaviourAsync(() => { injectedBehaviourExecuted = true; return Task.CompletedTask; }, 0.6, () => Task.FromResult(false));

            policy.ExecuteAsync(() => { userDelegateExecuted = true; return Task.CompletedTask; });

            userDelegateExecuted.Should().BeTrue();
            injectedBehaviourExecuted.Should().BeFalse();
        }

        [Fact]
        public void Given_enabled_and_randomly_within_threshold_should_inject_behaviour()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExecuted = false;

            var policy = MonkeyPolicy.InjectBehaviourAsync(() => { injectedBehaviourExecuted = true; return Task.CompletedTask; }, 0.6, () => Task.FromResult(true));

            policy.ExecuteAsync(() => { userDelegateExecuted = true; return Task.CompletedTask; });

            userDelegateExecuted.Should().BeTrue();
            injectedBehaviourExecuted.Should().BeTrue();
        }

        [Fact]
        public void Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExecuted = false;

            var policy = MonkeyPolicy.InjectBehaviourAsync(() => { injectedBehaviourExecuted = true; return Task.CompletedTask; }, 0.4, () => Task.FromResult(true));

            policy.ExecuteAsync(() => { userDelegateExecuted = true; return Task.CompletedTask; });

            userDelegateExecuted.Should().BeTrue();
            injectedBehaviourExecuted.Should().BeFalse();
        }

        [Fact]
        public void Should_inject_behaviour_before_executing_user_delegate()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExecuted = false;

            var policy = MonkeyPolicy.InjectBehaviourAsync(() =>
            {
                userDelegateExecuted.Should().BeFalse(); // Not yet executed at the time the injected behaviour runs.
                injectedBehaviourExecuted = true;
                return Task.CompletedTask;
            }, 0.6, () => Task.FromResult(true));

            policy.ExecuteAsync(() => { userDelegateExecuted = true; return Task.CompletedTask; });

            userDelegateExecuted.Should().BeTrue();
            injectedBehaviourExecuted.Should().BeTrue();
        }
    }
}

================================================
FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourAsyncWithOptionsSpecs.cs
================================================
using FluentAssertions;
using Polly.Contrib.Simmy.Utilities;
using System;
using System.Threading.Tasks;
using Polly.Contrib.Simmy.Behavior;
using Xunit;

namespace Polly.Contrib.Simmy.Specs.Behavior
{
    [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    public class InjectBehaviourAsyncWithOptionsSpecs : IDisposable
    {
        public InjectBehaviourAsyncWithOptionsSpecs()
        {
            ThreadSafeRandom_LockOncePerThread.NextDouble = () => 0.5;
        }

        public void Dispose()
        {
            ThreadSafeRandom_LockOncePerThread.Reset();
        }

        [Fact]
        public void Given_not_enabled_should_not_inject_behaviour()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExecuted = false;

            var policy = MonkeyPolicy.InjectBehaviourAsync(with =>
                with.Behaviour(() =>
                    {
                        injectedBehaviourExecuted = true;
                        return Task.CompletedTask;
                    })
                    .InjectionRate(0.6)
                    .Enabled(false)
                );

            policy.ExecuteAsync(() => { userDelegateExecuted = true; return Task.CompletedTask; });

            userDelegateExecuted.Should().BeTrue();
            injectedBehaviourExecuted.Should().BeFalse();
        }

        [Fact]
        public void Given_enabled_and_randomly_within_threshold_should_inject_behaviour()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExecuted = false;

            var policy = MonkeyPolicy.InjectBehaviourAsync(with =>
                with.Behaviour(() =>
                    {
                        injectedBehaviourExecuted = true;
                        return Task.CompletedTask;
                    })
                    .InjectionRate(0.6)
                    .Enabled()
            );

            policy.ExecuteAsync(() => { userDelegateExecuted = true; return Task.CompletedTask; });

            userDelegateExecuted.Should().BeTrue();
            injectedBehaviourExecuted.Should().BeTrue();
        }

        [Fact]
        public void Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExecuted = false;

            var policy = MonkeyPolicy.InjectBehaviourAsync(with =>
                with.Behaviour(() =>
                    {
                        injectedBehaviourExecuted = true;
                        return Task.CompletedTask;
                    })
                    .InjectionRate(0.4)
                    .Enabled(false)
            );

            policy.ExecuteAsync(() => { userDelegateExecuted = true; return Task.CompletedTask; });

            userDelegateExecuted.Should().BeTrue();
            injectedBehaviourExecuted.Should().BeFalse();
        }

        [Fact]
        public void Should_inject_behaviour_before_executing_user_delegate()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExecuted = false;

            var policy = MonkeyPolicy.InjectBehaviourAsync(with =>
                with.Behaviour(() =>
                    {
                        userDelegateExecuted.Should().BeFalse(); // Not yet executed at the time the injected behaviour runs.
                        injectedBehaviourExecuted = true;
                        return Task.CompletedTask;
                    })
                    .InjectionRate(0.6)
                    .Enabled()
            );

            policy.ExecuteAsync(() => { userDelegateExecuted = true; return Task.CompletedTask; });

            userDelegateExecuted.Should().BeTrue();
            injectedBehaviourExecuted.Should().BeTrue();
        }

        #region invalid threshold on configuration and execution time

        [Fact]
        public void Should_throw_error_on_configuration_time_when_threshold_is_negative()
        {
            Action act = () => MonkeyPolicy.InjectBehaviourAsync(with =>
                with.Behaviour(() => Task.CompletedTask)
                    .Enabled()
                    .InjectionRate(-1)
            );

            act.ShouldThrow<ArgumentOutOfRangeException>();
        }

        [Fact]
        public void Should_throw_error_on_configuration_time_when_threshold_is_greater_than_one()
        {
            Action act = () => MonkeyPolicy.InjectBehaviourAsync(with =>
                with.Behaviour(() => Task.CompletedTask)
                    .Enabled()
                    .InjectionRate(1.1)
            );

            act.ShouldThrow<ArgumentOutOfRangeException>();
        }

        [Fact]
        public void Should_throw_error_on_execution_time_when_threshold_is_is_negative()
        {
            var policy = MonkeyPolicy.InjectBehaviourAsync(with =>
                with.Behaviour(() => Task.CompletedTask)
                    .Enabled()
                    .InjectionRate((_, __) => Task.FromResult(-1d))
            );

            policy.Awaiting(async x => await x.ExecuteAsync(() => Task.CompletedTask))
                .ShouldThrow<ArgumentOutOfRangeException>();
        }

        [Fact]
        public void Should_throw_error_on_execution_time_when_threshold_is_greater_than_one()
        {
            var policy = MonkeyPolicy.InjectBehaviourAsync(with =>
                with.Behaviour(() => Task.CompletedTask)
                    .Enabled()
                    .InjectionRate((_, __) => Task.FromResult(1.1))
            );

            policy.Awaiting(async x => await x.ExecuteAsync(() => Task.CompletedTask))
                .ShouldThrow<ArgumentOutOfRangeException>();
        }

        #endregion
    }
}


================================================
FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourSpecs.cs
================================================
using System;
using FluentAssertions;
using Polly.Contrib.Simmy.Utilities;
using Xunit;

namespace Polly.Contrib.Simmy.Specs.Behavior
{
    [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    [Obsolete]
    public class InjectBehaviourSpecs : IDisposable
    {
        public InjectBehaviourSpecs()
        {
            ThreadSafeRandom_LockOncePerThread.NextDouble = () => 0.5;
        }

        public void Dispose()
        {
            ThreadSafeRandom_LockOncePerThread.Reset();
        }

        [Fact]
        public void Given_not_enabled_should_not_inject_behaviour()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExecuted = false;

            var policy = MonkeyPolicy.InjectBehaviour(() => { injectedBehaviourExecuted = true; }, 0.6, () => false);
            
            policy.Execute(() => { userDelegateExecuted = true; });

            userDelegateExecuted.Should().BeTrue();
            injectedBehaviourExecuted.Should().BeFalse();
        }

        [Fact]
        public void Given_enabled_and_randomly_within_threshold_should_inject_behaviour()
        {
            Boolean userDelegateExecuted = false;
            Boolean injectedBehaviourExe
Download .txt
gitextract_az8v0g9u/

├── .gitignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── GitVersionConfig.yaml
├── LICENSE.txt
├── README.md
├── appveyor.yml
├── build.bat
├── build.cake
├── build.ps1
└── src/
    ├── Polly.Contrib.Simmy/
    │   ├── AsyncMonkeyEngine.cs
    │   ├── AsyncMonkeyPolicy.cs
    │   ├── Behavior/
    │   │   ├── AsyncInjectBehaviourOptionsSyntax.cs
    │   │   ├── AsyncInjectBehaviourPolicy.cs
    │   │   ├── AsyncInjectBehaviourSyntax.cs
    │   │   ├── AsyncInjectBehaviourTResultOptionsSyntax.cs
    │   │   ├── AsyncInjectBehaviourTResultSyntax.cs
    │   │   ├── InjectBehaviourAsyncOptions.cs
    │   │   ├── InjectBehaviourAsyncOptionsExtensions.cs
    │   │   ├── InjectBehaviourOptions.cs
    │   │   ├── InjectBehaviourOptionsExtensions.cs
    │   │   ├── InjectBehaviourOptionsSyntax.cs
    │   │   ├── InjectBehaviourPolicy.cs
    │   │   ├── InjectBehaviourSyntax.cs
    │   │   ├── InjectBehaviourTResultOptionsSyntax.cs
    │   │   └── InjectBehaviourTResultSyntax.cs
    │   ├── IMonkeyPolicy.cs
    │   ├── InjectOptionsAsyncBase.cs
    │   ├── InjectOptionsAsyncBaseExtensions.cs
    │   ├── InjectOptionsBase.cs
    │   ├── InjectOptionsBaseExtensions.cs
    │   ├── Latency/
    │   │   ├── AsyncInjectLatencyOptionsSyntax.cs
    │   │   ├── AsyncInjectLatencyPolicy.cs
    │   │   ├── AsyncInjectLatencySyntax.cs
    │   │   ├── InjectLatencyAsyncOptions.cs
    │   │   ├── InjectLatencyAsyncOptionsExtensions.cs
    │   │   ├── InjectLatencyOptions.cs
    │   │   ├── InjectLatencyOptionsExtensions.cs
    │   │   ├── InjectLatencyOptionsSyntax.cs
    │   │   ├── InjectLatencyPolicy.cs
    │   │   └── InjectLatencySyntax.cs
    │   ├── MonkeyEngine.cs
    │   ├── MonkeyPolicy.cs
    │   ├── Outcomes/
    │   │   ├── AsyncInjectOutcomeOptionsSyntax.cs
    │   │   ├── AsyncInjectOutcomePolicy.cs
    │   │   ├── AsyncInjectOutcomeSyntax.cs
    │   │   ├── InjectOutcomeAsyncOptions.cs
    │   │   ├── InjectOutcomeAsyncOptionsExtensions.cs
    │   │   ├── InjectOutcomeOptions.cs
    │   │   ├── InjectOutcomeOptionsExtensions.cs
    │   │   ├── InjectOutcomeOptionsSyntax.cs
    │   │   ├── InjectOutcomePolicy.cs
    │   │   └── InjectOutcomeSyntax.cs
    │   ├── Polly.Contrib.Simmy.csproj
    │   └── Utilities/
    │       ├── GuardExtensions.cs
    │       └── ThreadSafeRandom_LockOncePerThread.cs
    ├── Polly.Contrib.Simmy.Specs/
    │   ├── Behavior/
    │   │   ├── InjectBehaviourAsyncSpecs.cs
    │   │   ├── InjectBehaviourAsyncWithOptionsSpecs.cs
    │   │   ├── InjectBehaviourSpecs.cs
    │   │   ├── InjectBehaviourTResultAsyncSpecs.cs
    │   │   ├── InjectBehaviourTResultAsyncWithOptionsSpecs.cs
    │   │   ├── InjectBehaviourTResultSpecs.cs
    │   │   ├── InjectBehaviourTResultWithOptionsSpecs.cs
    │   │   └── InjectBehaviourWithOptionsSpecs.cs
    │   ├── Helpers/
    │   │   ├── Constants.cs
    │   │   └── ResultPrimitive.cs
    │   ├── Latency/
    │   │   ├── InjectLatencyAsyncSpecs.cs
    │   │   ├── InjectLatencyAsyncWithOptionsSpecs.cs
    │   │   ├── InjectLatencySpecs.cs
    │   │   ├── InjectLatencyTResultAsyncSpecs .cs
    │   │   ├── InjectLatencyTResultAsyncWithOptionsSpecs.cs
    │   │   ├── InjectLatencyTResultSpecs.cs
    │   │   ├── InjectLatencyTResultWithOptionsSpecs.cs
    │   │   └── InjectLatencyWithOptionsSpecs.cs
    │   ├── Outcomes/
    │   │   ├── InjectFaultAsyncSpecs.cs
    │   │   ├── InjectFaultAsyncWithOptionsSpecs.cs
    │   │   ├── InjectFaultSpecs.cs
    │   │   ├── InjectFaultTResultAsyncSpecs.cs
    │   │   ├── InjectFaultTResultAsyncWithOptionsSpecs.cs
    │   │   ├── InjectFaultTResultSpecs.cs
    │   │   ├── InjectFaultTResultWithOptionsSpecs.cs
    │   │   └── InjectFaultWithOptionsSpecs.cs
    │   └── Polly.Contrib.Simmy.Specs.csproj
    ├── Polly.Contrib.Simmy.nuspec
    ├── Polly.Contrib.Simmy.sln
    └── Polly.Contrib.Simmy.snk
Download .txt
SYMBOL INDEX (590 symbols across 71 files)

FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourAsyncSpecs.cs
  class InjectBehaviourAsyncSpecs (line 9) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectBehaviourAsyncSpecs (line 13) | public InjectBehaviourAsyncSpecs()
    method Dispose (line 18) | public void Dispose()
    method Given_not_enabled_should_not_inject_behaviour (line 23) | [Fact]
    method Given_enabled_and_randomly_within_threshold_should_inject_behaviour (line 37) | [Fact]
    method Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour (line 51) | [Fact]
    method Should_inject_behaviour_before_executing_user_delegate (line 65) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourAsyncWithOptionsSpecs.cs
  class InjectBehaviourAsyncWithOptionsSpecs (line 10) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectBehaviourAsyncWithOptionsSpecs (line 13) | public InjectBehaviourAsyncWithOptionsSpecs()
    method Dispose (line 18) | public void Dispose()
    method Given_not_enabled_should_not_inject_behaviour (line 23) | [Fact]
    method Given_enabled_and_randomly_within_threshold_should_inject_behaviour (line 45) | [Fact]
    method Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour (line 67) | [Fact]
    method Should_inject_behaviour_before_executing_user_delegate (line 89) | [Fact]
    method Should_throw_error_on_configuration_time_when_threshold_is_negative (line 114) | [Fact]
    method Should_throw_error_on_configuration_time_when_threshold_is_greater_than_one (line 126) | [Fact]
    method Should_throw_error_on_execution_time_when_threshold_is_is_negative (line 138) | [Fact]
    method Should_throw_error_on_execution_time_when_threshold_is_greater_than_one (line 151) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourSpecs.cs
  class InjectBehaviourSpecs (line 8) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectBehaviourSpecs (line 12) | public InjectBehaviourSpecs()
    method Dispose (line 17) | public void Dispose()
    method Given_not_enabled_should_not_inject_behaviour (line 22) | [Fact]
    method Given_enabled_and_randomly_within_threshold_should_inject_behaviour (line 36) | [Fact]
    method Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour (line 50) | [Fact]
    method Should_inject_behaviour_before_executing_user_delegate (line 64) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourTResultAsyncSpecs.cs
  class InjectBehaviourTResultAsyncSpecs (line 10) | [Collection(Constants.AmbientContextDependentTestCollection)]
    method InjectBehaviourTResultAsyncSpecs (line 14) | public InjectBehaviourTResultAsyncSpecs()
    method Dispose (line 19) | public void Dispose()
    method Given_not_enabled_should_not_inject_behaviour (line 24) | [Fact]
    method Given_enabled_and_randomly_within_threshold_should_inject_behaviour (line 38) | [Fact]
    method Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour (line 52) | [Fact]
    method Should_inject_behaviour_before_executing_user_delegate (line 66) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourTResultAsyncWithOptionsSpecs.cs
  class InjectBehaviourTResultAsyncWithOptionsSpecs (line 11) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectBehaviourTResultAsyncWithOptionsSpecs (line 14) | public InjectBehaviourTResultAsyncWithOptionsSpecs()
    method Dispose (line 19) | public void Dispose()
    method Given_not_enabled_should_not_inject_behaviour (line 24) | [Fact]
    method Given_enabled_and_randomly_within_threshold_should_inject_behaviour (line 46) | [Fact]
    method Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour (line 68) | [Fact]
    method Should_inject_behaviour_before_executing_user_delegate (line 90) | [Fact]
    method Should_throw_error_on_configuration_time_when_threshold_is_negative (line 115) | [Fact]
    method Should_throw_error_on_configuration_time_when_threshold_is_greater_than_one (line 127) | [Fact]
    method Should_throw_error_on_execution_time_when_threshold_is_is_negative (line 139) | [Fact]
    method Should_throw_error_on_execution_time_when_threshold_is_greater_than_one (line 152) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourTResultSpecs.cs
  class InjectBehaviourTResultSpecs (line 9) | [Collection(Constants.AmbientContextDependentTestCollection)]
    method InjectBehaviourTResultSpecs (line 13) | public InjectBehaviourTResultSpecs()
    method Dispose (line 18) | public void Dispose()
    method Given_not_enabled_should_not_inject_behaviour (line 23) | [Fact]
    method Given_enabled_and_randomly_within_threshold_should_inject_behaviour (line 37) | [Fact]
    method Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour (line 51) | [Fact]
    method Should_inject_behaviour_before_executing_user_delegate (line 65) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourTResultWithOptionsSpecs.cs
  class InjectBehaviourTResultWithOptionsSpecs (line 10) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectBehaviourTResultWithOptionsSpecs (line 13) | public InjectBehaviourTResultWithOptionsSpecs()
    method Dispose (line 18) | public void Dispose()
    method Given_not_enabled_should_not_inject_behaviour (line 23) | [Fact]
    method Given_enabled_and_randomly_within_threshold_should_inject_behaviour (line 40) | [Fact]
    method Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour (line 57) | [Fact]
    method Should_inject_behaviour_before_executing_user_delegate (line 74) | [Fact]
    method Should_throw_error_on_configuration_time_when_threshold_is_negative (line 97) | [Fact]
    method Should_throw_error_on_configuration_time_when_threshold_is_greater_than_one (line 109) | [Fact]
    method Should_throw_error_on_execution_time_when_threshold_is_is_negative (line 121) | [Fact]
    method Should_throw_error_on_execution_time_when_threshold_is_greater_than_one (line 134) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourWithOptionsSpecs.cs
  class InjectBehaviourWithOptionsSpecs (line 9) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectBehaviourWithOptionsSpecs (line 12) | public InjectBehaviourWithOptionsSpecs()
    method Dispose (line 17) | public void Dispose()
    method Given_not_enabled_should_not_inject_behaviour (line 22) | [Fact]
    method Given_enabled_and_randomly_within_threshold_should_inject_behaviour (line 39) | [Fact]
    method Given_enabled_and_randomly_not_within_threshold_should_not_inject_behaviour (line 56) | [Fact]
    method Should_inject_behaviour_before_executing_user_delegate (line 73) | [Fact]
    method Should_throw_error_on_configuration_time_when_threshold_is_negative (line 96) | [Fact]
    method Should_throw_error_on_configuration_time_when_threshold_is_greater_than_one (line 108) | [Fact]
    method Should_throw_error_on_execution_time_when_threshold_is_is_negative (line 120) | [Fact]
    method Should_throw_error_on_execution_time_when_threshold_is_greater_than_one (line 133) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Helpers/Constants.cs
  class Constants (line 6) | public class Constants

FILE: src/Polly.Contrib.Simmy.Specs/Helpers/ResultPrimitive.cs
  type ResultPrimitive (line 6) | internal enum ResultPrimitive

FILE: src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyAsyncSpecs.cs
  class InjectLatencyAsyncSpecs (line 13) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectLatencyAsyncSpecs (line 19) | public InjectLatencyAsyncSpecs()
    method Dispose (line 25) | public void Dispose()
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_Enabled (line 34) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_Dissabled (line 48) | [Fact]
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_InjectionRate_Is_Covered (line 61) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 75) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Introduce_Delay (line 93) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay (line 115) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 137) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Introduce_Delay (line 159) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Not_Introduce_Delay (line 192) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Introduce_Delay (line 225) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay (line 269) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 313) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 361) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 411) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 461) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_latency_config_delegate (line 512) | [Fact]
    method InjectLatency_With_Context_Should_not_inject_the_whole_latency_if_user_cancelationtoken_is_signaled_from_timeout (line 563) | [Theory]

FILE: src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyAsyncWithOptionsSpecs.cs
  class InjectLatencyAsyncWithOptionsSpecs (line 14) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectLatencyAsyncWithOptionsSpecs (line 19) | public InjectLatencyAsyncWithOptionsSpecs()
    method Dispose (line 25) | public void Dispose()
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_Enabled (line 34) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_Dissabled (line 53) | [Fact]
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_InjectionRate_Is_Covered (line 70) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 88) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Introduce_Delay (line 110) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay (line 135) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 160) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Introduce_Delay (line 185) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Not_Introduce_Delay (line 224) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Introduce_Delay (line 263) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay (line 313) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 363) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 417) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 473) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 529) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_latency_config_delegate (line 586) | [Fact]
    method InjectLatency_With_Context_Should_not_inject_the_whole_latency_if_user_cancelationtoken_is_signaled_from_timeout (line 643) | [Theory]

FILE: src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencySpecs.cs
  class InjectLatencySpecs (line 12) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectLatencySpecs (line 18) | public InjectLatencySpecs()
    method Dispose (line 24) | public void Dispose()
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_Enabled (line 33) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_Dissabled (line 46) | [Fact]
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_InjectionRate_Is_Covered (line 58) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 71) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Introduce_Delay (line 88) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay (line 109) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 130) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Introduce_Delay (line 151) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Not_Introduce_Delay (line 183) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Introduce_Delay (line 215) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay (line 258) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 301) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 348) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 397) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 444) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_latency_config_delegate (line 493) | [Fact]
    method InjectLatency_With_Context_Should_not_inject_the_whole_latency_if_user_cancelationtoken_is_signaled_from_timeout (line 542) | [Theory]

FILE: src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyTResultAsyncSpecs .cs
  class InjectLatencyTResultAsyncSpecs (line 14) | [Collection(Constants.AmbientContextDependentTestCollection)]
    method InjectLatencyTResultAsyncSpecs (line 20) | public InjectLatencyTResultAsyncSpecs()
    method Dispose (line 26) | public void Dispose()
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_Enabled (line 35) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_Dissabled (line 50) | [Fact]
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_InjectionRate_Is_Covered (line 64) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 79) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Introduce_Delay (line 98) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay (line 121) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 144) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Introduce_Delay (line 167) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Not_Introduce_Delay (line 201) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Introduce_Delay (line 235) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay (line 280) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 325) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 374) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 424) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 474) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_latency_config_delegate (line 525) | [Fact]
    method InjectLatency_With_Context_Should_not_inject_the_whole_latency_if_user_cancelationtoken_is_signaled_from_timeout (line 576) | [Theory]

FILE: src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyTResultAsyncWithOptionsSpecs.cs
  class InjectLatencyTResultAsyncWithOptionsSpecs (line 15) | [Collection(Constants.AmbientContextDependentTestCollection)]
    method InjectLatencyTResultAsyncWithOptionsSpecs (line 20) | public InjectLatencyTResultAsyncWithOptionsSpecs()
    method Dispose (line 26) | public void Dispose()
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_Enabled (line 35) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_Dissabled (line 54) | [Fact]
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_InjectionRate_Is_Covered (line 72) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 91) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Introduce_Delay (line 114) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay (line 140) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 166) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Introduce_Delay (line 192) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Not_Introduce_Delay (line 232) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Introduce_Delay (line 272) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay (line 323) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 374) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 429) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 485) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 539) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_latency_config_delegate (line 594) | [Fact]
    method InjectLatency_With_Context_Should_not_inject_the_whole_latency_if_user_cancelationtoken_is_signaled_from_timeout (line 649) | [Theory]

FILE: src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyTResultSpecs.cs
  class InjectLatencyTResultSpecs (line 13) | [Collection(Constants.AmbientContextDependentTestCollection)]
    method InjectLatencyTResultSpecs (line 19) | public InjectLatencyTResultSpecs()
    method Dispose (line 25) | public void Dispose()
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_Enabled (line 34) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_Dissabled (line 49) | [Fact]
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_InjectionRate_Is_Covered (line 63) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 78) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Introduce_Delay (line 97) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay (line 120) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 143) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Introduce_Delay (line 166) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Not_Introduce_Delay (line 200) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Introduce_Delay (line 234) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay (line 279) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 324) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 372) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 422) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 471) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_latency_config_delegate (line 522) | [Fact]
    method InjectLatency_With_Context_Should_not_inject_the_whole_latency_if_user_cancelationtoken_is_signaled_from_timeout (line 572) | [Theory]

FILE: src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyTResultWithOptionsSpecs.cs
  class InjectLatencyTResultWithOptionsSpecs (line 14) | [Collection(Constants.AmbientContextDependentTestCollection)]
    method InjectLatencyTResultWithOptionsSpecs (line 19) | public InjectLatencyTResultWithOptionsSpecs()
    method Dispose (line 25) | public void Dispose()
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_Enabled (line 34) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_Dissabled (line 53) | [Fact]
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_InjectionRate_Is_Covered (line 71) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 90) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Introduce_Delay (line 113) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay (line 139) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 165) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Introduce_Delay (line 191) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Not_Introduce_Delay (line 231) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Introduce_Delay (line 271) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay (line 322) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 373) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 427) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 483) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 539) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_latency_config_delegate (line 596) | [Fact]
    method InjectLatency_With_Context_Should_not_inject_the_whole_latency_if_user_cancelationtoken_is_signaled_from_timeout (line 653) | [Theory]

FILE: src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyWithOptionsSpecs.cs
  class InjectLatencyWithOptionsSpecs (line 13) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectLatencyWithOptionsSpecs (line 18) | public InjectLatencyWithOptionsSpecs()
    method Dispose (line 24) | public void Dispose()
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_Enabled (line 33) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_Dissabled (line 50) | [Fact]
    method InjectLatency_Context_Free_Should_Introduce_Delay_If_InjectionRate_Is_Covered (line 66) | [Fact]
    method InjectLatency_Context_Free_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 83) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Introduce_Delay (line 104) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay (line 128) | [Fact]
    method InjectLatency_With_Context_With_Enabled_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 152) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Introduce_Delay (line 176) | [Fact]
    method InjectLatency_With_Context_With_InjectionRate_Lambda_Should_Not_Introduce_Delay (line 214) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Introduce_Delay (line 252) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay (line 301) | [Fact]
    method InjectLatency_With_Context_With_Latency_Lambda_Should_Not_Introduce_Delay_If_InjectionRate_Is_Not_Covered (line 350) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 403) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 458) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 511) | [Fact]
    method InjectLatency_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_latency_config_delegate (line 566) | [Fact]
    method InjectLatency_With_Context_Should_not_inject_the_whole_latency_if_user_cancelationtoken_is_signaled_from_timeout (line 621) | [Theory]

FILE: src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultAsyncSpecs.cs
  class InjectFaultAsyncSpecs (line 11) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectFaultAsyncSpecs (line 15) | public InjectFaultAsyncSpecs()
    method Dispose (line 20) | public void Dispose()
    method InjectFault_Context_Free_Enabled_Should_not_execute_user_delegate_async (line 26) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate_async (line 38) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate_not_throw_if_injected_fault_is_permitted_null (line 49) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async (line 64) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_async (line 84) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_async_with_enabled_lambda_false (line 103) | [Fact]
    method InjectFault_should_throw_if_injection_rate_is_out_of_range_too_low (line 125) | [Fact]
    method InjectFault_should_throw_if_injection_rate_is_out_of_range_too_high (line 141) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async_basic (line 157) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async_with_all_context_set (line 173) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 221) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 275) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 329) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_fault_config_delegate (line 383) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultAsyncWithOptionsSpecs.cs
  class InjectFaultAsyncWithOptionsSpecs (line 12) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectFaultAsyncWithOptionsSpecs (line 15) | public InjectFaultAsyncWithOptionsSpecs()
    method Dispose (line 20) | public void Dispose()
    method InjectFault_Context_Free_Enabled_Should_not_execute_user_delegate_async (line 26) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate_async (line 44) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate_not_throw_if_injected_fault_is_permitted_null (line 61) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async (line 81) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_async (line 102) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_async_with_enabled_lambda_false (line 122) | [Fact]
    method InjectFault_should_throw_if_injection_rate_is_out_of_range_too_low (line 145) | [Fact]
    method InjectFault_should_throw_if_injection_rate_is_out_of_range_too_high (line 166) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async_basic (line 187) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async_with_all_context_set (line 208) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 261) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 320) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 378) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_fault_config_delegate (line 436) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultSpecs.cs
  class InjectFaultSpecs (line 9) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectFaultSpecs (line 13) | public InjectFaultSpecs()
    method Dispose (line 18) | public void Dispose()
    method InjectFault_Context_Free_Enabled_Should_not_execute_user_delegate (line 24) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate (line 38) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate_not_throw_if_injected_fault_is_permitted_null (line 51) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate (line 67) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate (line 87) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_with_enabled_lambda_return_false (line 108) | [Fact]
    method InjectFault_should_throw_if_injection_rate_is_out_of_range_too_low (line 132) | [Fact]
    method InjectFault_should_throw_if_injection_rate_is_out_of_range_too_high (line 148) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_with_default_context (line 164) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_with_all_context_set (line 180) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 225) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 274) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 323) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_fault_config_delegate (line 372) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultTResultAsyncSpecs.cs
  class InjectFaultTResultAsyncSpecs (line 11) | [Collection(Constants.AmbientContextDependentTestCollection)]
    method InjectFaultTResultAsyncSpecs (line 15) | public InjectFaultTResultAsyncSpecs()
    method Dispose (line 20) | public void Dispose()
    method InjectFault_Context_Free_Enabled_Should_not_execute_user_delegate_async (line 26) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate_async (line 41) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async (line 57) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_async (line 80) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_async_with_enabled_lambda_return_false (line 105) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async_with_default_values (line 132) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async_with_all_values_set (line 153) | [Fact]
    method InjectFault_Context_Free_Should_Return_Fault_async (line 204) | [Fact]
    method InjectFault_Context_Free_Should_Not_Return_Fault_async (line 222) | [Fact]
    method InjectFault_With_Context_Enabled_Should_Return_Fault_async (line 240) | [Fact]
    method InjectFault_With_Context_Enabled_Should_Not_Return_Fault_async (line 264) | [Fact]
    method InjectFault_With_Context_InjectionRate_Should_Return_Fault_async (line 288) | [Fact]
    method InjectFault_With_Context_InjectionRate_Should_Not_Return_Fault_async (line 328) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 371) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 425) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 479) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_fault_config_delegate (line 533) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultTResultAsyncWithOptionsSpecs.cs
  class InjectFaultTResultAsyncWithOptionsSpecs (line 12) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectFaultTResultAsyncWithOptionsSpecs (line 15) | public InjectFaultTResultAsyncWithOptionsSpecs()
    method Dispose (line 20) | public void Dispose()
    method InjectFault_Context_Free_Enabled_Should_not_execute_user_delegate_async (line 26) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate_async (line 46) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async (line 67) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_async (line 87) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_async_with_enabled_lambda_return_false (line 109) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async_with_default_values (line 133) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_async_with_all_values_set (line 159) | [Fact]
    method InjectFault_Context_Free_Should_Return_Fault_async (line 217) | [Fact]
    method InjectFault_Context_Free_Should_Not_Return_Fault_async (line 240) | [Fact]
    method InjectFault_With_Context_Enabled_Should_Return_Fault_async (line 263) | [Fact]
    method InjectFault_With_Context_Enabled_Should_Not_Return_Fault_async (line 291) | [Fact]
    method InjectFault_With_Context_InjectionRate_Should_Return_Fault_async (line 319) | [Fact]
    method InjectFault_With_Context_InjectionRate_Should_Not_Return_Fault_async (line 363) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 411) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 470) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 528) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_fault_config_delegate (line 586) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultTResultSpecs.cs
  class InjectFaultTResultSpecs (line 10) | [Collection(Constants.AmbientContextDependentTestCollection)]
    method InjectFaultTResultSpecs (line 14) | public InjectFaultTResultSpecs()
    method Dispose (line 19) | public void Dispose()
    method InjectFaultContext_Free_Enabled_Should_not_execute_user_delegate (line 25) | [Fact]
    method InjectFaultContext_Free_Enabled_Should_execute_user_delegate (line 40) | [Fact]
    method InjectFaultWith_Context_Should_not_execute_user_delegate (line 57) | [Fact]
    method InjectFaultWith_Context_Should_execute_user_delegate (line 79) | [Fact]
    method InjectFaultWith_Context_Should_execute_user_delegate_with_enabled_lambda_disabled (line 101) | [Fact]
    method InjectFaultWith_Context_Should_not_execute_user_delegate_default_context (line 125) | [Fact]
    method InjectFaultWith_Context_Should_not_execute_user_delegate_full_context (line 142) | [Fact]
    method InjectFaultContext_Free_Should_Return_Fault (line 187) | [Fact]
    method InjectFaultContext_Free_Should_Not_Return_Fault (line 200) | [Fact]
    method InjectFaultWith_Context_Enabled_Should_Return_Fault (line 213) | [Fact]
    method InjectFaultWith_Context_Enabled_Should_Not_Return_Fault (line 232) | [Fact]
    method InjectFaultWith_Context_InjectionRate_Should_Return_Fault (line 251) | [Fact]
    method InjectFaultWith_Context_InjectionRate_Should_Not_Return_Fault (line 285) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 322) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 373) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 424) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_fault_config_delegate (line 475) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultTResultWithOptionsSpecs.cs
  class InjectFaultTResultWithOptionsSpecs (line 11) | [Collection(Constants.AmbientContextDependentTestCollection)]
    method InjectFaultTResultWithOptionsSpecs (line 14) | public InjectFaultTResultWithOptionsSpecs()
    method Dispose (line 19) | public void Dispose()
    method InjectFaultContext_Free_Enabled_Should_not_execute_user_delegate (line 25) | [Fact]
    method InjectFaultContext_Free_Enabled_Should_execute_user_delegate (line 45) | [Fact]
    method InjectFaultWith_Context_Should_not_execute_user_delegate (line 67) | [Fact]
    method InjectFaultWith_Context_Should_execute_user_delegate (line 86) | [Fact]
    method InjectFaultWith_Context_Should_execute_user_delegate_with_enabled_lambda_disabled (line 105) | [Fact]
    method InjectFaultWith_Context_Should_not_execute_user_delegate_default_context (line 126) | [Fact]
    method InjectFaultWith_Context_Should_not_execute_user_delegate_full_context (line 149) | [Fact]
    method InjectFaultContext_Free_Should_Return_Fault (line 201) | [Fact]
    method InjectFaultContext_Free_Should_Not_Return_Fault (line 219) | [Fact]
    method InjectFaultWith_Context_Enabled_Should_Return_Fault (line 237) | [Fact]
    method InjectFaultWith_Context_Enabled_Should_Not_Return_Fault (line 260) | [Fact]
    method InjectFaultWith_Context_InjectionRate_Should_Return_Fault (line 283) | [Fact]
    method InjectFaultWith_Context_InjectionRate_Should_Not_Return_Fault (line 321) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 363) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 419) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 474) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_fault_config_delegate (line 529) | [Fact]

FILE: src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultWithOptionsSpecs.cs
  class InjectFaultWithOptionsSpecs (line 10) | [Collection(Helpers.Constants.AmbientContextDependentTestCollection)]
    method InjectFaultWithOptionsSpecs (line 13) | public InjectFaultWithOptionsSpecs()
    method Dispose (line 18) | public void Dispose()
    method InjectFault_Context_Free_Enabled_Should_not_execute_user_delegate (line 24) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate (line 43) | [Fact]
    method InjectFault_Context_Free_Enabled_Should_execute_user_delegate_not_throw_if_injected_fault_is_permitted_null (line 61) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate (line 82) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate (line 100) | [Fact]
    method InjectFault_With_Context_Should_execute_user_delegate_with_enabled_lambda_return_false (line 119) | [Fact]
    method InjectFault_should_throw_if_injection_rate_is_out_of_range_too_low (line 141) | [Fact]
    method InjectFault_should_throw_if_injection_rate_is_out_of_range_too_high (line 163) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_with_default_context (line 185) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_with_all_context_set (line 207) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_before_to_start_execution (line 259) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_enabled_config_delegate (line 315) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_injectionrate_config_delegate (line 370) | [Fact]
    method InjectFault_With_Context_Should_not_execute_user_delegate_if_user_cancelationtoken_cancelled_on_fault_config_delegate (line 425) | [Fact]

FILE: src/Polly.Contrib.Simmy/AsyncMonkeyEngine.cs
  class AsyncMonkeyEngine (line 8) | internal static class AsyncMonkeyEngine
    method ShouldInjectAsync (line 10) | private static async Task<bool> ShouldInjectAsync(
    method InjectBehaviourImplementationAsync (line 37) | internal static async Task<TResult> InjectBehaviourImplementationAsync...
    method InjectExceptionImplementationAsync (line 56) | internal static async Task<TResult> InjectExceptionImplementationAsync...
    method InjectResultImplementationAsync (line 81) | internal static async Task<TResult> InjectResultImplementationAsync<TR...

FILE: src/Polly.Contrib.Simmy/AsyncMonkeyPolicy.cs
  class AsyncMonkeyPolicy (line 10) | public abstract class AsyncMonkeyPolicy : AsyncPolicy, IMonkeyPolicy
    method AsyncMonkeyPolicy (line 15) | internal AsyncMonkeyPolicy(Func<Context, CancellationToken, Task<Doubl...
    method AsyncMonkeyPolicy (line 31) | internal AsyncMonkeyPolicy(Func<Context, CancellationToken, Task<Doubl...
  class AsyncMonkeyPolicy (line 26) | public abstract class AsyncMonkeyPolicy<TResult> : AsyncPolicy<TResult>,...
    method AsyncMonkeyPolicy (line 15) | internal AsyncMonkeyPolicy(Func<Context, CancellationToken, Task<Doubl...
    method AsyncMonkeyPolicy (line 31) | internal AsyncMonkeyPolicy(Func<Context, CancellationToken, Task<Doubl...

FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourOptionsSyntax.cs
  class MonkeyPolicy (line 9) | public partial class MonkeyPolicy
    method InjectBehaviourAsync (line 17) | public static AsyncInjectBehaviourPolicy InjectBehaviourAsync(Action<I...

FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourPolicy.cs
  class AsyncInjectBehaviourPolicy (line 10) | public class AsyncInjectBehaviourPolicy : AsyncMonkeyPolicy
    method AsyncInjectBehaviourPolicy (line 14) | [Obsolete]
    method AsyncInjectBehaviourPolicy (line 21) | internal AsyncInjectBehaviourPolicy(InjectBehaviourAsyncOptions options)
    method ImplementationAsync (line 28) | protected override Task<TResult> ImplementationAsync<TResult>(Func<Con...
    method AsyncInjectBehaviourPolicy (line 50) | [Obsolete]
    method AsyncInjectBehaviourPolicy (line 57) | internal AsyncInjectBehaviourPolicy(InjectBehaviourAsyncOptions options)
    method ImplementationAsync (line 64) | protected override Task<TResult> ImplementationAsync(Func<Context, Can...
  class AsyncInjectBehaviourPolicy (line 46) | public class AsyncInjectBehaviourPolicy<TResult> : AsyncMonkeyPolicy<TRe...
    method AsyncInjectBehaviourPolicy (line 14) | [Obsolete]
    method AsyncInjectBehaviourPolicy (line 21) | internal AsyncInjectBehaviourPolicy(InjectBehaviourAsyncOptions options)
    method ImplementationAsync (line 28) | protected override Task<TResult> ImplementationAsync<TResult>(Func<Con...
    method AsyncInjectBehaviourPolicy (line 50) | [Obsolete]
    method AsyncInjectBehaviourPolicy (line 57) | internal AsyncInjectBehaviourPolicy(InjectBehaviourAsyncOptions options)
    method ImplementationAsync (line 64) | protected override Task<TResult> ImplementationAsync(Func<Context, Can...

FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourSyntax.cs
  class MonkeyPolicy (line 11) | public partial class MonkeyPolicy
    method InjectBehaviourAsync (line 21) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviourAsync (line 45) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviourAsync (line 68) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviourAsync (line 90) | [Obsolete("This overload is going to be deprecated, use the overload w...

FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourTResultOptionsSyntax.cs
  class MonkeyPolicy (line 9) | public partial class MonkeyPolicy
    method InjectBehaviourAsync (line 17) | public static AsyncInjectBehaviourPolicy<TResult> InjectBehaviourAsync...

FILE: src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourTResultSyntax.cs
  class MonkeyPolicy (line 11) | public partial class MonkeyPolicy
    method InjectBehaviourAsync (line 21) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviourAsync (line 45) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviourAsync (line 68) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviourAsync (line 90) | [Obsolete("This overload is going to be deprecated, use the overload w...

FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourAsyncOptions.cs
  class InjectBehaviourAsyncOptions (line 10) | public class InjectBehaviourAsyncOptions : InjectOptionsAsyncBase

FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourAsyncOptionsExtensions.cs
  class InjectBehaviourAsyncOptionsExtensions (line 10) | public static class InjectBehaviourAsyncOptionsExtensions
    method Behaviour (line 17) | public static InjectBehaviourAsyncOptions Behaviour(this InjectBehavio...
    method Behaviour (line 25) | public static InjectBehaviourAsyncOptions Behaviour(this InjectBehavio...

FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourOptions.cs
  class InjectBehaviourOptions (line 9) | public class InjectBehaviourOptions : InjectOptionsBase

FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourOptionsExtensions.cs
  class InjectBehaviourOptionsExtensions (line 9) | public static class InjectBehaviourOptionsExtensions
    method Behaviour (line 16) | public static InjectBehaviourOptions Behaviour(this InjectBehaviourOpt...
    method Behaviour (line 24) | public static InjectBehaviourOptions Behaviour(this InjectBehaviourOpt...

FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourOptionsSyntax.cs
  class MonkeyPolicy (line 9) | public partial class MonkeyPolicy
    method InjectBehaviour (line 17) | public static InjectBehaviourPolicy InjectBehaviour(Action<InjectBehav...

FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourPolicy.cs
  class InjectBehaviourPolicy (line 9) | public class InjectBehaviourPolicy : Simmy.MonkeyPolicy
    method InjectBehaviourPolicy (line 13) | [Obsolete]
    method InjectBehaviourPolicy (line 20) | internal InjectBehaviourPolicy(InjectBehaviourOptions options)
    method Implementation (line 27) | protected override TResult Implementation<TResult>(Func<Context, Cance...
    method InjectBehaviourPolicy (line 46) | [Obsolete]
    method InjectBehaviourPolicy (line 53) | internal InjectBehaviourPolicy(InjectBehaviourOptions options)
    method Implementation (line 60) | protected override TResult Implementation(Func<Context, CancellationTo...
  class InjectBehaviourPolicy (line 42) | public class InjectBehaviourPolicy<TResult> : MonkeyPolicy<TResult>
    method InjectBehaviourPolicy (line 13) | [Obsolete]
    method InjectBehaviourPolicy (line 20) | internal InjectBehaviourPolicy(InjectBehaviourOptions options)
    method Implementation (line 27) | protected override TResult Implementation<TResult>(Func<Context, Cance...
    method InjectBehaviourPolicy (line 46) | [Obsolete]
    method InjectBehaviourPolicy (line 53) | internal InjectBehaviourPolicy(InjectBehaviourOptions options)
    method Implementation (line 60) | protected override TResult Implementation(Func<Context, CancellationTo...

FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourSyntax.cs
  class MonkeyPolicy (line 10) | public partial class MonkeyPolicy
    method InjectBehaviour (line 20) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviour (line 44) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviour (line 67) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviour (line 88) | [Obsolete("This overload is going to be deprecated, use the overload w...

FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourTResultOptionsSyntax.cs
  class MonkeyPolicy (line 9) | public partial class MonkeyPolicy
    method InjectBehaviour (line 17) | public static InjectBehaviourPolicy<TResult> InjectBehaviour<TResult>(...

FILE: src/Polly.Contrib.Simmy/Behavior/InjectBehaviourTResultSyntax.cs
  class MonkeyPolicy (line 10) | public partial class MonkeyPolicy
    method InjectBehaviour (line 20) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviour (line 44) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviour (line 67) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectBehaviour (line 88) | [Obsolete("This overload is going to be deprecated, use the overload w...

FILE: src/Polly.Contrib.Simmy/IMonkeyPolicy.cs
  type IMonkeyPolicy (line 6) | public interface IMonkeyPolicy : IsPolicy
  type IMonkeyPolicy (line 13) | public interface IMonkeyPolicy<TResult> : IMonkeyPolicy

FILE: src/Polly.Contrib.Simmy/InjectOptionsAsyncBase.cs
  class InjectOptionsAsyncBase (line 10) | public abstract class InjectOptionsAsyncBase

FILE: src/Polly.Contrib.Simmy/InjectOptionsAsyncBaseExtensions.cs
  class InjectOptionsAsyncBaseExtensions (line 11) | public static class InjectOptionsAsyncBaseExtensions
    method Enabled (line 17) | public static InjectOptionsAsyncBase Enabled(this InjectOptionsAsyncBa...
    method Enabled (line 24) | public static InjectOptionsAsyncBase Enabled(this InjectOptionsAsyncBa...
    method EnabledWhen (line 35) | public static InjectOptionsAsyncBase EnabledWhen(this InjectOptionsAsy...
    method InjectionRate (line 46) | public static InjectOptionsAsyncBase InjectionRate(this InjectOptionsA...
    method InjectionRate (line 58) | public static InjectOptionsAsyncBase InjectionRate(this InjectOptionsA...

FILE: src/Polly.Contrib.Simmy/InjectOptionsBase.cs
  class InjectOptionsBase (line 9) | public abstract class InjectOptionsBase

FILE: src/Polly.Contrib.Simmy/InjectOptionsBaseExtensions.cs
  class InjectOptionsBaseExtensions (line 10) | public static class InjectOptionsBaseExtensions
    method Enabled (line 16) | public static InjectOptionsBase Enabled(this InjectOptionsBase options...
    method Enabled (line 23) | public static InjectOptionsBase Enabled(this InjectOptionsBase options...
    method EnabledWhen (line 34) | public static InjectOptionsBase EnabledWhen(this InjectOptionsBase opt...
    method InjectionRate (line 45) | public static InjectOptionsBase InjectionRate(this InjectOptionsBase o...
    method InjectionRate (line 57) | public static InjectOptionsBase InjectionRate(this InjectOptionsBase o...

FILE: src/Polly.Contrib.Simmy/Latency/AsyncInjectLatencyOptionsSyntax.cs
  class MonkeyPolicy (line 9) | public partial class MonkeyPolicy
    method InjectLatencyAsync (line 17) | public static AsyncInjectLatencyPolicy InjectLatencyAsync(Action<Injec...
    method InjectLatencyAsync (line 35) | public static AsyncInjectLatencyPolicy<TResult> InjectLatencyAsync<TRe...

FILE: src/Polly.Contrib.Simmy/Latency/AsyncInjectLatencyPolicy.cs
  class AsyncInjectLatencyPolicy (line 11) | public class AsyncInjectLatencyPolicy : AsyncMonkeyPolicy
    method AsyncInjectLatencyPolicy (line 15) | [Obsolete]
    method AsyncInjectLatencyPolicy (line 25) | internal AsyncInjectLatencyPolicy(InjectLatencyAsyncOptions options)
    method ImplementationAsync (line 32) | protected override Task<TResult> ImplementationAsync<TResult>(
    method AsyncInjectLatencyPolicy (line 66) | [Obsolete]
    method AsyncInjectLatencyPolicy (line 76) | internal AsyncInjectLatencyPolicy(InjectLatencyAsyncOptions options)
    method ImplementationAsync (line 83) | protected override Task<TResult> ImplementationAsync(
  class AsyncInjectLatencyPolicy (line 62) | public class AsyncInjectLatencyPolicy<TResult> : AsyncMonkeyPolicy<TResult>
    method AsyncInjectLatencyPolicy (line 15) | [Obsolete]
    method AsyncInjectLatencyPolicy (line 25) | internal AsyncInjectLatencyPolicy(InjectLatencyAsyncOptions options)
    method ImplementationAsync (line 32) | protected override Task<TResult> ImplementationAsync<TResult>(
    method AsyncInjectLatencyPolicy (line 66) | [Obsolete]
    method AsyncInjectLatencyPolicy (line 76) | internal AsyncInjectLatencyPolicy(InjectLatencyAsyncOptions options)
    method ImplementationAsync (line 83) | protected override Task<TResult> ImplementationAsync(

FILE: src/Polly.Contrib.Simmy/Latency/AsyncInjectLatencySyntax.cs
  class MonkeyPolicy (line 8) | public partial class MonkeyPolicy
    method InjectLatencyAsync (line 18) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 41) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 63) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 84) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 108) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 131) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 153) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 174) | [Obsolete("This overload is going to be deprecated, use the overload w...
  class MonkeyPolicy (line 98) | public partial class MonkeyPolicy
    method InjectLatencyAsync (line 18) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 41) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 63) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 84) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 108) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 131) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 153) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatencyAsync (line 174) | [Obsolete("This overload is going to be deprecated, use the overload w...

FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyAsyncOptions.cs
  class InjectLatencyAsyncOptions (line 10) | public class InjectLatencyAsyncOptions : InjectOptionsAsyncBase

FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyAsyncOptionsExtensions.cs
  class InjectLatencyAsyncOptionsExtensions (line 10) | public static class InjectLatencyAsyncOptionsExtensions
    method Latency (line 17) | public static InjectLatencyAsyncOptions Latency(this InjectLatencyAsyn...
    method Latency (line 25) | public static InjectLatencyAsyncOptions Latency(this InjectLatencyAsyn...

FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyOptions.cs
  class InjectLatencyOptions (line 9) | public class InjectLatencyOptions : InjectOptionsBase

FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyOptionsExtensions.cs
  class InjectLatencyOptionsExtensions (line 9) | public static class InjectLatencyOptionsExtensions
    method Latency (line 16) | public static InjectLatencyOptions Latency(this InjectLatencyOptions o...
    method Latency (line 24) | public static InjectLatencyOptions Latency(this InjectLatencyOptions o...

FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyOptionsSyntax.cs
  class MonkeyPolicy (line 9) | public partial class MonkeyPolicy
    method InjectLatency (line 17) | public static InjectLatencyPolicy InjectLatency(Action<InjectLatencyOp...
    method InjectLatency (line 35) | public static InjectLatencyPolicy<TResult> InjectLatency<TResult>(Acti...

FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencyPolicy.cs
  class InjectLatencyPolicy (line 10) | public class InjectLatencyPolicy : MonkeyPolicy
    method InjectLatencyPolicy (line 14) | [Obsolete]
    method InjectLatencyPolicy (line 24) | internal InjectLatencyPolicy(InjectLatencyOptions options)
    method Implementation (line 31) | protected override TResult Implementation<TResult>(Func<Context, Cance...
    method InjectLatencyPolicy (line 58) | [Obsolete]
    method InjectLatencyPolicy (line 68) | internal InjectLatencyPolicy(InjectLatencyOptions options)
    method Implementation (line 75) | protected override TResult Implementation(Func<Context, CancellationTo...
  class InjectLatencyPolicy (line 54) | public class InjectLatencyPolicy<TResult> : MonkeyPolicy<TResult>
    method InjectLatencyPolicy (line 14) | [Obsolete]
    method InjectLatencyPolicy (line 24) | internal InjectLatencyPolicy(InjectLatencyOptions options)
    method Implementation (line 31) | protected override TResult Implementation<TResult>(Func<Context, Cance...
    method InjectLatencyPolicy (line 58) | [Obsolete]
    method InjectLatencyPolicy (line 68) | internal InjectLatencyPolicy(InjectLatencyOptions options)
    method Implementation (line 75) | protected override TResult Implementation(Func<Context, CancellationTo...

FILE: src/Polly.Contrib.Simmy/Latency/InjectLatencySyntax.cs
  class MonkeyPolicy (line 7) | public partial class MonkeyPolicy
    method InjectLatency (line 17) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 36) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 55) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 75) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 99) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 118) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 137) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 157) | [Obsolete("This overload is going to be deprecated, use the overload w...
  class MonkeyPolicy (line 89) | public partial class MonkeyPolicy
    method InjectLatency (line 17) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 36) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 55) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 75) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 99) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 118) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 137) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectLatency (line 157) | [Obsolete("This overload is going to be deprecated, use the overload w...

FILE: src/Polly.Contrib.Simmy/MonkeyEngine.cs
  class MonkeyEngine (line 7) | internal static class MonkeyEngine
    method ShouldInject (line 9) | private static bool ShouldInject(Context context, CancellationToken ca...
    method InjectBehaviourImplementation (line 31) | internal static TResult InjectBehaviourImplementation<TResult>(
    method InjectExceptionImplementation (line 49) | internal static TResult InjectExceptionImplementation<TResult>(
    method InjectResultImplementation (line 73) | internal static TResult InjectResultImplementation<TResult>(

FILE: src/Polly.Contrib.Simmy/MonkeyPolicy.cs
  class MonkeyPolicy (line 9) | public abstract partial class MonkeyPolicy : Policy, IMonkeyPolicy
    method MonkeyPolicy (line 15) | internal MonkeyPolicy(Func<Context, CancellationToken, Double> injecti...
    method MonkeyPolicy (line 32) | internal MonkeyPolicy(Func<Context, CancellationToken, Double> injecti...
  class MonkeyPolicy (line 26) | public abstract class MonkeyPolicy<TResult> : Policy<TResult>, IMonkeyPo...
    method MonkeyPolicy (line 15) | internal MonkeyPolicy(Func<Context, CancellationToken, Double> injecti...
    method MonkeyPolicy (line 32) | internal MonkeyPolicy(Func<Context, CancellationToken, Double> injecti...

FILE: src/Polly.Contrib.Simmy/Outcomes/AsyncInjectOutcomeOptionsSyntax.cs
  class MonkeyPolicy (line 9) | public partial class MonkeyPolicy
    method InjectExceptionAsync (line 17) | public static AsyncInjectOutcomePolicy InjectExceptionAsync(Action<Inj...
    method InjectResultAsync (line 35) | public static AsyncInjectOutcomePolicy<TResult> InjectResultAsync<TRes...
    method InjectResultAsync (line 53) | public static AsyncInjectOutcomePolicy<TResult> InjectResultAsync<TRes...

FILE: src/Polly.Contrib.Simmy/Outcomes/AsyncInjectOutcomePolicy.cs
  class AsyncInjectOutcomePolicy (line 11) | public class AsyncInjectOutcomePolicy : AsyncMonkeyPolicy
    method AsyncInjectOutcomePolicy (line 15) | [Obsolete]
    method AsyncInjectOutcomePolicy (line 22) | internal AsyncInjectOutcomePolicy(InjectOutcomeAsyncOptions<Exception>...
    method ImplementationAsync (line 29) | protected override Task<TResult> ImplementationAsync<TResult>(Func<Con...
    method AsyncInjectOutcomePolicy (line 51) | [Obsolete]
    method AsyncInjectOutcomePolicy (line 58) | [Obsolete]
    method AsyncInjectOutcomePolicy (line 65) | internal AsyncInjectOutcomePolicy(InjectOutcomeAsyncOptions<Exception>...
    method AsyncInjectOutcomePolicy (line 71) | internal AsyncInjectOutcomePolicy(InjectOutcomeAsyncOptions<TResult> o...
    method ImplementationAsync (line 78) | protected override async Task<TResult> ImplementationAsync(Func<Contex...
  class AsyncInjectOutcomePolicy (line 46) | public class AsyncInjectOutcomePolicy<TResult> : AsyncMonkeyPolicy<TResult>
    method AsyncInjectOutcomePolicy (line 15) | [Obsolete]
    method AsyncInjectOutcomePolicy (line 22) | internal AsyncInjectOutcomePolicy(InjectOutcomeAsyncOptions<Exception>...
    method ImplementationAsync (line 29) | protected override Task<TResult> ImplementationAsync<TResult>(Func<Con...
    method AsyncInjectOutcomePolicy (line 51) | [Obsolete]
    method AsyncInjectOutcomePolicy (line 58) | [Obsolete]
    method AsyncInjectOutcomePolicy (line 65) | internal AsyncInjectOutcomePolicy(InjectOutcomeAsyncOptions<Exception>...
    method AsyncInjectOutcomePolicy (line 71) | internal AsyncInjectOutcomePolicy(InjectOutcomeAsyncOptions<TResult> o...
    method ImplementationAsync (line 78) | protected override async Task<TResult> ImplementationAsync(Func<Contex...

FILE: src/Polly.Contrib.Simmy/Outcomes/AsyncInjectOutcomeSyntax.cs
  class MonkeyPolicy (line 8) | public partial class MonkeyPolicy
    method InjectFaultAsync (line 18) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 41) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 63) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 88) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 111) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 133) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 157) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 183) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 205) | [Obsolete("This overload is going to be deprecated, use the overload w...
  class MonkeyPolicy (line 77) | public partial class MonkeyPolicy
    method InjectFaultAsync (line 18) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 41) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 63) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 88) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 111) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 133) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 157) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 183) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFaultAsync (line 205) | [Obsolete("This overload is going to be deprecated, use the overload w...

FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeAsyncOptions.cs
  class InjectOutcomeAsyncOptions (line 10) | public class InjectOutcomeAsyncOptions<TResult> : InjectOptionsAsyncBase

FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeAsyncOptionsExtensions.cs
  class InjectOutcomeAsyncOptionsExtensions (line 10) | public static class InjectOutcomeAsyncOptionsExtensions
    method Fault (line 17) | public static InjectOutcomeAsyncOptions<Exception> Fault(this InjectOu...
    method Fault (line 25) | public static InjectOutcomeAsyncOptions<Exception> Fault(this InjectOu...
    method Fault (line 36) | public static InjectOutcomeAsyncOptions<Exception> Fault<TResult>(this...
    method Fault (line 44) | public static InjectOutcomeAsyncOptions<Exception> Fault<TResult>(this...
    method Result (line 55) | public static InjectOutcomeAsyncOptions<TResult> Result<TResult>(this ...
    method Result (line 63) | public static InjectOutcomeAsyncOptions<TResult> Result<TResult>(this ...

FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeOptions.cs
  class InjectOutcomeOptions (line 9) | public class InjectOutcomeOptions<TResult> : InjectOptionsBase

FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeOptionsExtensions.cs
  class InjectOutcomeOptionsExtensions (line 9) | public static class InjectOutcomeOptionsExtensions
    method Fault (line 16) | public static InjectOutcomeOptions<Exception> Fault(this InjectOutcome...
    method Fault (line 24) | public static InjectOutcomeOptions<Exception> Fault(this InjectOutcome...
    method Fault (line 35) | public static InjectOutcomeOptions<Exception> Fault<TResult>(this Inje...
    method Fault (line 43) | public static InjectOutcomeOptions<Exception> Fault<TResult>(this Inje...
    method Result (line 54) | public static InjectOutcomeOptions<TResult> Result<TResult>(this Injec...
    method Result (line 62) | public static InjectOutcomeOptions<TResult> Result<TResult>(this Injec...

FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeOptionsSyntax.cs
  class MonkeyPolicy (line 9) | public partial class MonkeyPolicy
    method InjectException (line 17) | public static InjectOutcomePolicy InjectException(Action<InjectOutcome...
    method InjectResult (line 35) | public static InjectOutcomePolicy<TResult> InjectResult<TResult>(Actio...
    method InjectResult (line 53) | public static InjectOutcomePolicy<TResult> InjectResult<TResult>(Actio...

FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomePolicy.cs
  class InjectOutcomePolicy (line 10) | public class InjectOutcomePolicy : MonkeyPolicy
    method InjectOutcomePolicy (line 14) | [Obsolete]
    method InjectOutcomePolicy (line 21) | internal InjectOutcomePolicy(InjectOutcomeOptions<Exception> options)
    method Implementation (line 28) | protected override TResult Implementation<TResult>(Func<Context, Cance...
    method InjectOutcomePolicy (line 48) | [Obsolete]
    method InjectOutcomePolicy (line 55) | [Obsolete]
    method InjectOutcomePolicy (line 62) | internal InjectOutcomePolicy(InjectOutcomeOptions<Exception> options)
    method InjectOutcomePolicy (line 68) | internal InjectOutcomePolicy(InjectOutcomeOptions<TResult> options)
    method Implementation (line 75) | protected override TResult Implementation(Func<Context, CancellationTo...
  class InjectOutcomePolicy (line 43) | public class InjectOutcomePolicy<TResult> : MonkeyPolicy<TResult>
    method InjectOutcomePolicy (line 14) | [Obsolete]
    method InjectOutcomePolicy (line 21) | internal InjectOutcomePolicy(InjectOutcomeOptions<Exception> options)
    method Implementation (line 28) | protected override TResult Implementation<TResult>(Func<Context, Cance...
    method InjectOutcomePolicy (line 48) | [Obsolete]
    method InjectOutcomePolicy (line 55) | [Obsolete]
    method InjectOutcomePolicy (line 62) | internal InjectOutcomePolicy(InjectOutcomeOptions<Exception> options)
    method InjectOutcomePolicy (line 68) | internal InjectOutcomePolicy(InjectOutcomeOptions<TResult> options)
    method Implementation (line 75) | protected override TResult Implementation(Func<Context, CancellationTo...

FILE: src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeSyntax.cs
  class MonkeyPolicy (line 7) | public partial class MonkeyPolicy
    method InjectFault (line 17) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 40) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 62) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 87) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 110) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 132) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 157) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 180) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 202) | [Obsolete("This overload is going to be deprecated, use the overload w...
  class MonkeyPolicy (line 76) | public partial class MonkeyPolicy
    method InjectFault (line 17) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 40) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 62) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 87) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 110) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 132) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 157) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 180) | [Obsolete("This overload is going to be deprecated, use the overload w...
    method InjectFault (line 202) | [Obsolete("This overload is going to be deprecated, use the overload w...

FILE: src/Polly.Contrib.Simmy/Utilities/GuardExtensions.cs
  class GuardExtensions (line 5) | internal static class GuardExtensions
    method EnsureInjectionThreshold (line 7) | public static void EnsureInjectionThreshold(this double injectionThres...

FILE: src/Polly.Contrib.Simmy/Utilities/ThreadSafeRandom_LockOncePerThread.cs
  class ThreadSafeRandom_LockOncePerThread (line 23) | public class ThreadSafeRandom_LockOncePerThread
    method ThreadSafeRandom_LockOncePerThread (line 28) | static ThreadSafeRandom_LockOncePerThread()
    method InitializeThreadRandom (line 37) | private static Random InitializeThreadRandom()
    method Reset (line 59) | public static void Reset()
Condensed preview — 87 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (593K chars).
[
  {
    "path": ".gitignore",
    "chars": 1635,
    "preview": "# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)\n[Bb]in/\n[Oo]bj/\n\n# mstest test results\nTestResu"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 485,
    "preview": "## 0.3.0\r\n- Add a new Fluent-builder syntax \r\n- Add intuitive syntax for result stubbing, for use in unit-tests or in ot"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 133,
    "preview": "We ask our contributors to abide by the [Code of Conduct of the .NET Foundation](https://www.dotnetfoundation.org/code-o"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 208,
    "preview": "Please see the Instructions for Contributing in the [Polly ReadMe](https://github.com/App-vNext/Polly#instructions-for-c"
  },
  {
    "path": "GitVersionConfig.yaml",
    "chars": 19,
    "preview": "next-version: 0.3.0"
  },
  {
    "path": "LICENSE.txt",
    "chars": 1536,
    "preview": "New BSD License\r\n=\r\nCopyright (c) 2018-2019, App vNext\r\nAll rights reserved.\r\n\r\nRedistribution and use in source and bin"
  },
  {
    "path": "README.md",
    "chars": 13427,
    "preview": "# Simmy\n\n\n\nSimmy is a [chaos-engineering](http://principlesofchaos.org/) and fault-injection tool, integrating with the "
  },
  {
    "path": "appveyor.yml",
    "chars": 250,
    "preview": "os: Visual Studio 2019\n\n# Build script\nbuild_script:\n  - ps: .\\build.ps1\n\n# Tests\ntest: off\n\nartifacts:\n  - path: artifa"
  },
  {
    "path": "build.bat",
    "chars": 129,
    "preview": "@ECHO OFF\nPUSHD %~dp0\nPowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command \"& './build.ps1'\"\n\nIF %errorlevel% neq "
  },
  {
    "path": "build.cake",
    "chars": 9516,
    "preview": "///////////////////////////////////////////////////////////////////////////////\n// ARGUMENTS\n//////////////////////////"
  },
  {
    "path": "build.ps1",
    "chars": 3574,
    "preview": "<#\n\n.SYNOPSIS\nThis is a Powershell script to bootstrap a Cake build.\n\n.DESCRIPTION\nThis Powershell script will download "
  },
  {
    "path": "src/Polly.Contrib.Simmy/AsyncMonkeyEngine.cs",
    "chars": 4905,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Polly.Contrib.Simmy.Utilities;\n\nnamespace Pol"
  },
  {
    "path": "src/Polly.Contrib.Simmy/AsyncMonkeyPolicy.cs",
    "chars": 1796,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourOptionsSyntax.cs",
    "chars": 1309,
    "preview": "using System;\nusing Polly.Contrib.Simmy.Behavior;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Fluent API"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourPolicy.cs",
    "chars": 3243,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy.Behavior\n{\n    /// <"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourSyntax.cs",
    "chars": 5928,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Polly.Contrib.Simmy.Behavior;\n\nnamespace Poll"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourTResultOptionsSyntax.cs",
    "chars": 1336,
    "preview": "using System;\nusing Polly.Contrib.Simmy.Behavior;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Fluent API"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/AsyncInjectBehaviourTResultSyntax.cs",
    "chars": 6035,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Polly.Contrib.Simmy.Behavior;\n\nnamespace Poll"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/InjectBehaviourAsyncOptions.cs",
    "chars": 489,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy.Behavior\n{\n    /// <"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/InjectBehaviourAsyncOptionsExtensions.cs",
    "chars": 1299,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy.Behavior\n{\n    /// <"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/InjectBehaviourOptions.cs",
    "chars": 445,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy.Behavior\n{\n    /// <summary>\n    /// Options used "
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/InjectBehaviourOptionsExtensions.cs",
    "chars": 1235,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy.Behavior\n{\n    /// <summary>\n    /// Allows config"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/InjectBehaviourOptionsSyntax.cs",
    "chars": 1279,
    "preview": "using System;\nusing Polly.Contrib.Simmy.Behavior;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Fluent API"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/InjectBehaviourPolicy.cs",
    "chars": 2957,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy.Behavior\n{\n    /// <summary>\n    /// A policy that"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/InjectBehaviourSyntax.cs",
    "chars": 5712,
    "preview": "using System;\nusing System.Threading;\nusing Polly.Contrib.Simmy.Behavior;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <sum"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/InjectBehaviourTResultOptionsSyntax.cs",
    "chars": 1306,
    "preview": "using System;\nusing Polly.Contrib.Simmy.Behavior;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Fluent API"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Behavior/InjectBehaviourTResultSyntax.cs",
    "chars": 5778,
    "preview": "using System;\nusing System.Threading;\nusing Polly.Contrib.Simmy.Behavior;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <sum"
  },
  {
    "path": "src/Polly.Contrib.Simmy/IMonkeyPolicy.cs",
    "chars": 466,
    "preview": "namespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Defines properties and methods common to all Monkey policies."
  },
  {
    "path": "src/Polly.Contrib.Simmy/InjectOptionsAsyncBase.cs",
    "chars": 660,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n"
  },
  {
    "path": "src/Polly.Contrib.Simmy/InjectOptionsAsyncBaseExtensions.cs",
    "chars": 2922,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Polly.Contrib.Simmy.Utilities;\n\nnamespace Pol"
  },
  {
    "path": "src/Polly.Contrib.Simmy/InjectOptionsBase.cs",
    "chars": 614,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Options used to config"
  },
  {
    "path": "src/Polly.Contrib.Simmy/InjectOptionsBaseExtensions.cs",
    "chars": 2790,
    "preview": "using Polly.Contrib.Simmy.Utilities;\nusing System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <su"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/AsyncInjectLatencyOptionsSyntax.cs",
    "chars": 2368,
    "preview": "using System;\nusing Polly.Contrib.Simmy.Latency;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Fluent API "
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/AsyncInjectLatencyPolicy.cs",
    "chars": 4454,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Polly.Utilities;\n\nnamespace Polly.Contrib.Sim"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/AsyncInjectLatencySyntax.cs",
    "chars": 11180,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Polly.Contrib.Simmy.Latency;\n\nnamespace Polly"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/InjectLatencyAsyncOptions.cs",
    "chars": 490,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy.Latency\n{\n    /// <s"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/InjectLatencyAsyncOptionsExtensions.cs",
    "chars": 1263,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy.Latency\n{\n    /// <s"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/InjectLatencyOptions.cs",
    "chars": 444,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy.Latency\n{\n    /// <summary>\n    /// Options used t"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/InjectLatencyOptionsExtensions.cs",
    "chars": 1185,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy.Latency\n{\n    /// <summary>\n    /// Allows configu"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/InjectLatencyOptionsSyntax.cs",
    "chars": 2313,
    "preview": "using System;\nusing Polly.Contrib.Simmy.Latency;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Fluent API "
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/InjectLatencyPolicy.cs",
    "chars": 3702,
    "preview": "using System;\nusing System.Threading;\nusing Polly.Utilities;\n\nnamespace Polly.Contrib.Simmy.Latency\n{\n    /// <summary>"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Latency/InjectLatencySyntax.cs",
    "chars": 9642,
    "preview": "using System;\nusing System.Threading;\nusing Polly.Contrib.Simmy.Latency;\n\nnamespace Polly.Contrib.Simmy\n{\n    public pa"
  },
  {
    "path": "src/Polly.Contrib.Simmy/MonkeyEngine.cs",
    "chars": 3866,
    "preview": "using System;\nusing System.Threading;\nusing Polly.Contrib.Simmy.Utilities;\n\nnamespace Polly.Contrib.Simmy\n{\n    interna"
  },
  {
    "path": "src/Polly.Contrib.Simmy/MonkeyPolicy.cs",
    "chars": 1695,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Contains common functi"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/AsyncInjectOutcomeOptionsSyntax.cs",
    "chars": 3479,
    "preview": "using System;\nusing Polly.Contrib.Simmy.Outcomes;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Fluent API"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/AsyncInjectOutcomePolicy.cs",
    "chars": 4834,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy.Outcomes\n{\n    /// <"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/AsyncInjectOutcomeSyntax.cs",
    "chars": 13143,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Polly.Contrib.Simmy.Outcomes;\n\nnamespace Poll"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeAsyncOptions.cs",
    "chars": 486,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy.Outcomes\n{\n    /// <"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeAsyncOptionsExtensions.cs",
    "chars": 3224,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Polly.Contrib.Simmy.Outcomes\n{\n    /// <"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeOptions.cs",
    "chars": 448,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy.Outcomes\n{\n    /// <summary>\n    /// Options used "
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeOptionsExtensions.cs",
    "chars": 3083,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy.Outcomes\n{\n    /// <summary>\n    /// Allows config"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeOptionsSyntax.cs",
    "chars": 3436,
    "preview": "using System;\nusing Polly.Contrib.Simmy.Outcomes;\n\nnamespace Polly.Contrib.Simmy\n{\n    /// <summary>\n    /// Fluent API"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/InjectOutcomePolicy.cs",
    "chars": 4400,
    "preview": "using System;\nusing System.Threading;\n\nnamespace Polly.Contrib.Simmy.Outcomes\n{\n    /// <summary>\n    /// A policy that"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Outcomes/InjectOutcomeSyntax.cs",
    "chars": 12225,
    "preview": "using System;\nusing System.Threading;\nusing Polly.Contrib.Simmy.Outcomes;\n\nnamespace Polly.Contrib.Simmy\n{\n    public p"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Polly.Contrib.Simmy.csproj",
    "chars": 1633,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netstandard1.1;netstandard2.0;netstandard2.1"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Utilities/GuardExtensions.cs",
    "chars": 754,
    "preview": "using System;\n\nnamespace Polly.Contrib.Simmy.Utilities\n{\n    internal static class GuardExtensions\n    {\n        public"
  },
  {
    "path": "src/Polly.Contrib.Simmy/Utilities/ThreadSafeRandom_LockOncePerThread.cs",
    "chars": 3156,
    "preview": "using System;\nusing System.Threading;\n\n// Note: Given the current .NET Core (2.1) and .NET Framework (4.7.2) implementa"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourAsyncSpecs.cs",
    "chars": 3153,
    "preview": "using System;\nusing System.Threading.Tasks;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Utilities;\nusing Xunit;\n\n"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourAsyncWithOptionsSpecs.cs",
    "chars": 5807,
    "preview": "using FluentAssertions;\nusing Polly.Contrib.Simmy.Utilities;\nusing System;\nusing System.Threading.Tasks;\nusing Polly.Co"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourSpecs.cs",
    "chars": 2786,
    "preview": "using System;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Utilities;\nusing Xunit;\n\nnamespace Polly.Contrib.Simmy."
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourTResultAsyncSpecs.cs",
    "chars": 3344,
    "preview": "using System;\nusing System.Threading.Tasks;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Specs.Helpers;\nusing Poll"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourTResultAsyncWithOptionsSpecs.cs",
    "chars": 6112,
    "preview": "using System;\nusing System.Threading.Tasks;\nusing Polly.Contrib.Simmy.Behavior;\nusing Polly.Contrib.Simmy.Specs.Helpers"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourTResultSpecs.cs",
    "chars": 3004,
    "preview": "using System;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Specs.Helpers;\nusing Polly.Contrib.Simmy.Utilities;\nusi"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourTResultWithOptionsSpecs.cs",
    "chars": 5325,
    "preview": "using System;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Behavior;\nusing Polly.Contrib.Simmy.Specs.Helpers;\nusin"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Behavior/InjectBehaviourWithOptionsSpecs.cs",
    "chars": 4984,
    "preview": "using System;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Behavior;\nusing Polly.Contrib.Simmy.Utilities;\nusing Xu"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Helpers/Constants.cs",
    "chars": 574,
    "preview": "namespace Polly.Contrib.Simmy.Specs.Helpers\n{\n    /// <summary>\n    /// Constants supporting tests.\n    /// </summary>\n"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Helpers/ResultPrimitive.cs",
    "chars": 442,
    "preview": "namespace Polly.Contrib.Simmy.Specs.Helpers\n{\n    /// <summary>\n    /// A helper class supporting tests on how Policy&l"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyAsyncSpecs.cs",
    "chars": 23593,
    "preview": "using System;\nusing System.Diagnostics;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing FluentAssertions;\nu"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyAsyncWithOptionsSpecs.cs",
    "chars": 25840,
    "preview": "using System;\nusing System.Diagnostics;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing FluentAssertions;\nu"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencySpecs.cs",
    "chars": 20058,
    "preview": "using System;\nusing System.Diagnostics;\nusing System.Threading;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Utili"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyTResultAsyncSpecs .cs",
    "chars": 25312,
    "preview": "using System;\nusing System.Diagnostics;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing FluentAssertions;\nu"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyTResultAsyncWithOptionsSpecs.cs",
    "chars": 27430,
    "preview": "using System;\nusing System.Diagnostics;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Polly.Contrib.Simmy"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyTResultSpecs.cs",
    "chars": 22642,
    "preview": "using System;\nusing System.Diagnostics;\nusing System.Threading;\nusing FluentAssertions;\nusing Polly.Utilities;\nusing Po"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyTResultWithOptionsSpecs.cs",
    "chars": 24975,
    "preview": "using System;\nusing System.Diagnostics;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Specs.Helpers;\nusing Polly.Co"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Latency/InjectLatencyWithOptionsSpecs.cs",
    "chars": 22304,
    "preview": "using System;\nusing System.Diagnostics;\nusing System.Threading;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Laten"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultAsyncSpecs.cs",
    "chars": 17485,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.U"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultAsyncWithOptionsSpecs.cs",
    "chars": 19008,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.O"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultSpecs.cs",
    "chars": 15065,
    "preview": "using System;\nusing System.Threading;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Utilities;\nusing Xunit;\n\nnamesp"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultTResultAsyncSpecs.cs",
    "chars": 22299,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.S"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultTResultAsyncWithOptionsSpecs.cs",
    "chars": 23969,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.O"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultTResultSpecs.cs",
    "chars": 19420,
    "preview": "using System;\nusing System.Threading;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Specs.Helpers;\nusing Polly.Cont"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultTResultWithOptionsSpecs.cs",
    "chars": 21059,
    "preview": "using System;\nusing System.Threading;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Outcomes;\nusing Polly.Contrib.S"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Outcomes/InjectFaultWithOptionsSpecs.cs",
    "chars": 16479,
    "preview": "using System;\nusing System.Threading;\nusing FluentAssertions;\nusing Polly.Contrib.Simmy.Outcomes;\nusing Polly.Contrib.S"
  },
  {
    "path": "src/Polly.Contrib.Simmy.Specs/Polly.Contrib.Simmy.Specs.csproj",
    "chars": 951,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netcoreapp1.1;netcoreapp2.1;netcoreapp3.0;ne"
  },
  {
    "path": "src/Polly.Contrib.Simmy.nuspec",
    "chars": 1778,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<package>\n  <metadata>\n    <owners>App vNext</owners>\n    <authors>App vNext</au"
  },
  {
    "path": "src/Polly.Contrib.Simmy.sln",
    "chars": 1651,
    "preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.168\nMi"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the Polly-Contrib/Simmy GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 87 files (553.9 KB), approximately 113.3k tokens, and a symbol index with 590 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!