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
<PackageReference Include="Orleans.FSharp.Testing" Version="5.0.1" />
<PackageVersion Include="Orleans.FSharp.Testing" Version="5.0.1" />
<PackageReference Include="Orleans.FSharp.Testing" />
paket add Orleans.FSharp.Testing --version 5.0.1
#r "nuget: Orleans.FSharp.Testing, 5.0.1"
#:package Orleans.FSharp.Testing@5.0.1
#addin nuget:?package=Orleans.FSharp.Testing&version=5.0.1
#tool nuget:?package=Orleans.FSharp.Testing&version=5.0.1
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.TestingHostFsCheckTypeShapexunit
License
MIT
| Product | Versions 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. |
-
net10.0
- FsCheck (>= 3.3.3)
- FSharp.Control.TaskSeq (>= 1.1.1)
- FSharp.Core (>= 10.1.201)
- FSharp.SystemTextJson (>= 1.4.36)
- FsToolkit.ErrorHandling (>= 5.2.0)
- IcedTasks (>= 0.11.9)
- Microsoft.AspNetCore.TestHost (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.9)
- Microsoft.Extensions.Hosting (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Orleans.BroadcastChannel (>= 10.1.0)
- Microsoft.Orleans.Core.Abstractions (>= 10.1.0)
- Microsoft.Orleans.EventSourcing (>= 10.1.0)
- Microsoft.Orleans.Persistence.Memory (>= 10.1.0)
- Microsoft.Orleans.Reminders (>= 10.1.0)
- Microsoft.Orleans.Runtime (>= 10.1.0)
- Microsoft.Orleans.Sdk (>= 10.1.0)
- Microsoft.Orleans.Serialization.SystemTextJson (>= 10.1.0)
- Microsoft.Orleans.Server (>= 10.1.0)
- Microsoft.Orleans.Streaming (>= 10.1.0)
- Microsoft.Orleans.TestingHost (>= 10.1.0)
- Microsoft.Orleans.Transactions (>= 10.1.0)
- Orleans.FSharp (>= 5.0.1)
- Orleans.FSharp.Runtime (>= 5.0.1)
- Polly (>= 8.7.0)
- Serilog.Extensions.Logging (>= 10.0.0)
- TypeShape (>= 10.0.0)
- xunit (>= 2.9.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.