Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PropertyGroup>
<Authors>dsarfati,seniorquico</Authors>
<Product>Orleans TestKit</Product>
<Copyright>Copyright © 2017-2021 Daniel Sarfati. 2021-2025 Kyle Dodson. All rights reserved.</Copyright>
<Copyright>Copyright © 2017-2021 Daniel Sarfati. 2021-2026 Kyle Dodson. All rights reserved.</Copyright>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -17,7 +17,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<AnalysisLevel>latest-Recommended</AnalysisLevel>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MIT License

Copyright (c) 2017-2021 Daniel Sarfati
Copyright (c) 2021-2025 Kyle Dodson
Copyright (c) 2021-2026 Kyle Dodson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions OrleansTestKit.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10
# Visual Studio Version 18
VisualStudioVersion = 18.3.11520.95
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{54C04CF7-7044-46E0-BC24-2A992F028557}"
EndProject
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,20 @@ It is recommended that you consider developing a mixture of tests based on both

## Getting Started

There are four branches and major versions of the Orleans TestKit. The [`main`](https://github.com/OrleansContrib/OrleansTestKit/tree/main) branch provides Orleans TestKit 9, a stable version supporting Orleans 9. The [`8.x`](https://github.com/OrleansContrib/OrleansTestKit/tree/8.x) branch provides Orleans TestKit 8, a stable version supporting Microsoft Orleans 8. The [`4.x`](https://github.com/OrleansContrib/OrleansTestKit/tree/4.x) branch provides Orleans TestKit 4, a stable version supporting Microsoft Orleans 7 (during development, it was known as Orlean 4). The [`3.x`](https://github.com/OrleansContrib/OrleansTestKit/tree/3.x) branch provides Orleans TestKit 3, a stable version supporting Microsoft Orleans 3.
There are five branches and major versions of the Orleans TestKit. The [`main`](https://github.com/OrleansContrib/OrleansTestKit/tree/main) branch provides Orleans TestKit 10, a stable version supporting Orleans 10. The [`9.x`](https://github.com/OrleansContrib/OrleansTestKit/tree/9.x) branch provides Orleans TestKit 9, a stable version supporting Microsoft Orleans 9. The [`8.x`](https://github.com/OrleansContrib/OrleansTestKit/tree/8.x) branch provides Orleans TestKit 8, a stable version supporting Microsoft Orleans 8. The [`4.x`](https://github.com/OrleansContrib/OrleansTestKit/tree/4.x) branch provides Orleans TestKit 4, a stable version supporting Microsoft Orleans 7 (during development, it was known as Orlean 4). The [`3.x`](https://github.com/OrleansContrib/OrleansTestKit/tree/3.x) branch provides Orleans TestKit 3, a stable version supporting Microsoft Orleans 3.

If you are using Microsoft Orleans 9, install the latest, stable [`OrleansTestKit`](https://www.nuget.org/packages/OrleansTestKit) NuGet package in your test project. For example, run the following command in your Visual Studio Package Manager Console:
If you are using Microsoft Orleans 10, install the latest, stable [`OrleansTestKit`](https://www.nuget.org/packages/OrleansTestKit) NuGet package in your test project. For example, run the following command in your Visual Studio Package Manager Console:

```pwsh
Install-Package OrleansTestKit
```

If you are using Microsoft Orleans 9, install the latest, stable version less than 10.0 of the [`OrleansTestKit`](https://www.nuget.org/packages/OrleansTestKit) NuGet package in your test project. For example, run the following command in your Visual Studio Package Manager Console, replacing `9.x.x` with the latest version of the NuGet package less than 10.0:

```pwsh
Install-Package OrleansTestKit -Version 9.x.x
```

If you are using Microsoft Orleans 8, install the latest, stable version less than 9.0 of the [`OrleansTestKit`](https://www.nuget.org/packages/OrleansTestKit) NuGet package in your test project. For example, run the following command in your Visual Studio Package Manager Console, replacing `8.x.x` with the latest version of the NuGet package less than 9.0:

```pwsh
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"sdk": {
"allowPrerelease": false,
"rollForward": "latestFeature",
"version": "9.0.306"
"version": "10.0.103"
}
}
12 changes: 6 additions & 6 deletions src/OrleansTestKit/OrleansTestKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageTags>Orleans Cloud-Computing Actor-Model Actors Distributed-Systems C# .NET Test Testing</PackageTags>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>9.0.0</Version>
<Version>10.0.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -27,14 +27,14 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Orleans.Reminders" Version="9.2.1" />
<PackageReference Include="Microsoft.Orleans.Streaming" Version="9.2.1" />
<PackageReference Include="Microsoft.Orleans.Runtime" Version="9.2.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PackageReference Include="Microsoft.Orleans.Reminders" Version="10.0.0" />
<PackageReference Include="Microsoft.Orleans.Streaming" Version="10.0.0" />
<PackageReference Include="Microsoft.Orleans.Runtime" Version="10.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.103">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
30 changes: 15 additions & 15 deletions src/OrleansTestKit/TestGrainActivationContext.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using Orleans.Runtime;
namespace Orleans.TestKit;

namespace Orleans.TestKit;

/// <summary>
/// Grain context used for tests.
/// </summary>
/// <summary>Grain context used for tests.</summary>
public sealed class TestGrainActivationContext : IGrainContext
{
/// <inheritdoc/>
Expand All @@ -27,14 +23,10 @@
/// <inheritdoc/>
public object GrainInstance { get; set; } = default!;

public void Migrate(Dictionary<string, object>? requestContext, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException();

/// <inheritdoc/>
public GrainReference GrainReference { get; set; } = default!;

/// <summary>
/// Gets or sets the grain type used for this test context.
/// </summary>
/// <summary>Gets or sets the grain type used for this test context.</summary>
public Type GrainType { get; set; } = default!;

/// <inheritdoc/>
Expand All @@ -46,31 +38,39 @@
/// <inheritdoc/>
public void Activate(Dictionary<string, object> requestContext, CancellationToken? cancellationToken = null) => throw new NotImplementedException();

public void Activate(Dictionary<string, object>? requestContext, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException();

/// <inheritdoc/>
public void Deactivate(DeactivationReason deactivationReason, CancellationToken? cancellationToken = null) => throw new NotImplementedException();

public void Deactivate(DeactivationReason deactivationReason, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException();

/// <inheritdoc/>
public bool Equals(IGrainContext? other) => ReferenceEquals(this, other);

/// <inheritdoc/>
public TComponent GetComponent<TComponent>() where TComponent : class => throw new NotImplementedException();

/// <inheritdoc/>
public object? GetComponent(Type componentType) => throw new NotImplementedException();

/// <inheritdoc/>
public TTarget GetTarget<TTarget>() where TTarget : class => throw new NotImplementedException();

/// <inheritdoc/>
public object? GetTarget() => throw new NotImplementedException();

public void Migrate(Dictionary<string, object>? requestContext, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException();

/// <inheritdoc/>
public void Migrate(Dictionary<string, object> requestContext, CancellationToken? cancellationToken = null) => throw new NotImplementedException();

/// <inheritdoc/>
public void ReceiveMessage(object message) => throw new NotImplementedException();

public void Activate(Dictionary<string, object>? requestContext, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException();

public void Deactivate(DeactivationReason deactivationReason, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException();

/// <inheritdoc/>
public void Rehydrate(IRehydrationContext context) => throw new NotImplementedException();

/// <inheritdoc/>
public void SetComponent<TComponent>(TComponent value) where TComponent : class => throw new NotImplementedException();

Check warning on line 75 in src/OrleansTestKit/TestGrainActivationContext.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Nullability of reference types in type of parameter 'value' of 'void TestGrainActivationContext.SetComponent<TComponent>(TComponent value)' doesn't match implicitly implemented member 'void IGrainContext.SetComponent<TComponent>(TComponent? value)' (possibly because of nullability attributes).
}
9 changes: 7 additions & 2 deletions src/OrleansTestKit/TestGrainFactory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Moq;
using Orleans.Runtime;

namespace Orleans.TestKit;

Expand Down Expand Up @@ -70,8 +69,14 @@ public IGrain GetGrain(Type grainInterfaceType, Guid grainPrimaryKey, string key
public IGrain GetGrain(Type grainInterfaceType, long grainPrimaryKey, string keyExtension) =>
GetProbe(grainInterfaceType, GrainIdKeyExtensions.CreateIntegerKey(grainPrimaryKey, keyExtension), null);

public IAddressable GetGrain(Type interfaceType, IdSpan grainKey, string grainClassNamePrefix) =>
GetProbe(interfaceType, grainKey, grainClassNamePrefix);

public IAddressable GetGrain(Type interfaceType, IdSpan grainKey) =>
GetProbe(interfaceType, grainKey, null);

internal Mock<T> AddProbe<T>(IdSpan identity, string? grainClassNamePrefix = null)
where T : class, IGrain
where T : class, IGrain
{
var key = GetKey(identity, typeof(T), grainClassNamePrefix);
var mock = new Mock<T>();
Expand Down
19 changes: 10 additions & 9 deletions test/OrleansTestKit.Tests/OrleansTestKit.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>Orleans.TestKit.Tests</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<PackageReference Include="coverlet.msbuild" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="FakeItEasy" Version="8.3.0" />
<PackageReference Include="FluentAssertions" Version="7.2.0" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.14.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Microsoft.Orleans.Sdk" Version="9.2.1" />
<PackageReference Include="FakeItEasy" Version="9.0.1" />
<PackageReference Include="FluentAssertions" Version="7.2.1" />
<PackageReference Include="Microsoft.CodeCoverage" Version="18.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="Microsoft.Orleans.Sdk" Version="10.0.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.10" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.analyzers" Version="1.24.0">
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.3" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.analyzers" Version="1.27.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
1 change: 0 additions & 1 deletion test/OrleansTestKit.Tests/Tests/LoggerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using TestGrains;
using TestInterfaces;
using Xunit;
using Xunit.Abstractions;

namespace Orleans.TestKit.Tests;

Expand Down
Loading