Orleans.FSharp.Testing 5.0.1

dotnet add package Orleans.FSharp.Testing --version 5.0.1
                    
NuGet\Install-Package Orleans.FSharp.Testing -Version 5.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Orleans.FSharp.Testing" Version="5.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Orleans.FSharp.Testing" Version="5.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Orleans.FSharp.Testing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Orleans.FSharp.Testing --version 5.0.1
                    
#r "nuget: Orleans.FSharp.Testing, 5.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Orleans.FSharp.Testing@5.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Orleans.FSharp.Testing&version=5.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Orleans.FSharp.Testing&version=5.0.1
                    
Install as a Cake Tool

Orleans.FSharp.Testing

TestingHost, web-host, property-testing, mock-factory, and log-capture helpers for Orleans.FSharp.

Functional grain integration tests

Functional definitions are registered on a real Orleans TestCluster, then called through the same typed API record used in production. This exercises transport, activation, serialization, and persistence without fabricating the runtime-owned FunctionalGrainContext.

open System.Threading.Tasks
open Orleans
open Orleans.Hosting
open Orleans.TestingHost
open Orleans.FSharp

type CounterActor = private CounterActor of unit

[<NoEquality; NoComparison>]
type CounterApi = { increment: unit -> Task<int> }

let counterContract =
    grainContract<CounterActor, string, CounterApi> {
        grainType "testing.counter"
        version 1
        stringKey
    }

let counterDefinition =
    grainFor counterContract {
        defaultState (fun () -> 0)
        handle (_.increment) (fun _ count () ->
            task {
                let next = count + 1
                return next, next
            })
    }

type CounterSiloConfigurator() =
    interface ISiloConfigurator with
        member _.Configure(siloBuilder: ISiloBuilder) =
            siloBuilder.AddMemoryGrainStorage("Default") |> ignore
            siloBuilder.AddFunctionalGrain(counterDefinition) |> ignore

type CounterClientConfigurator() =
    interface IClientBuilderConfigurator with
        member _.Configure(_configuration, clientBuilder: IClientBuilder) =
            clientBuilder.AddFunctionalGrainClient() |> ignore

counterDefinition and its typed reference come from the same grainContract / grainFor module as production code. See the complete, self-contained fixture in the Testing guide.

Components

Component Purpose
TestHarness A conventional in-process Orleans cluster with memory providers and log capture
WebTestHarness Combined TestCluster and ASP.NET Core TestServer
WebTestHarness.createWithFactory TestServer over a supplied IGrainFactory
GrainMock.withGrain Register a mocked Orleans interface in MockGrainFactory
GrainArbitrary TypeShape-backed FsCheck generation for F# states and command DUs
FsCheckHelpers Command-sequence and state-machine property helpers
LogCapture Structured in-memory ILogger entries for assertions

Log capture

open Microsoft.Extensions.Logging
open Orleans.FSharp.Testing

let factory = LogCapture.create ()
let logger = (factory :> ILoggerFactory).CreateLogger("Test")
logger.LogInformation("Processed {Count}", 3)

let entries = LogCapture.captureLogs factory

Legacy archive

Compatibility helpers for the old authoring model remain temporarily for migration, but are unsupported. Their archived examples live in Legacy Testing.

Dependencies

  • Microsoft.Orleans.TestingHost
  • FsCheck
  • TypeShape
  • xunit

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.1 103 9/7/2026
5.0.0 98 9/7/2026
4.1.0 122 8/21/2026
4.0.2 102 8/20/2026
4.0.1 100 8/20/2026
4.0.0 101 8/19/2026
3.0.2 103 8/8/2026
3.0.1 130 6/29/2026
3.0.0 128 6/29/2026
2.0.0-alpha.1 78 4/28/2026
1.0.0 141 4/3/2026