From cc17e1b00707d2fb85125da8b86f55b9831b4ecf Mon Sep 17 00:00:00 2001 From: Jacob Lundberg Date: Sat, 24 Jan 2026 11:09:00 +0100 Subject: [PATCH 1/2] Upgrade OrleansTestKit to Orleans 10.0.0 and version 10.0.0 --- src/OrleansTestKit/OrleansTestKit.csproj | 8 ++--- .../TestGrainActivationContext.cs | 30 +++++++++---------- src/OrleansTestKit/TestGrainFactory.cs | 9 ++++-- .../OrleansTestKit.Tests.csproj | 2 +- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/OrleansTestKit/OrleansTestKit.csproj b/src/OrleansTestKit/OrleansTestKit.csproj index d1a7db8..a06708a 100644 --- a/src/OrleansTestKit/OrleansTestKit.csproj +++ b/src/OrleansTestKit/OrleansTestKit.csproj @@ -15,7 +15,7 @@ Orleans Cloud-Computing Actor-Model Actors Distributed-Systems C# .NET Test Testing true snupkg - 9.0.0 + 10.0.0 @@ -27,9 +27,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers diff --git a/src/OrleansTestKit/TestGrainActivationContext.cs b/src/OrleansTestKit/TestGrainActivationContext.cs index 5fadec4..920227c 100644 --- a/src/OrleansTestKit/TestGrainActivationContext.cs +++ b/src/OrleansTestKit/TestGrainActivationContext.cs @@ -1,10 +1,6 @@ -using Orleans.Runtime; +namespace Orleans.TestKit; -namespace Orleans.TestKit; - -/// -/// Grain context used for tests. -/// +/// Grain context used for tests. public sealed class TestGrainActivationContext : IGrainContext { /// @@ -27,14 +23,10 @@ public sealed class TestGrainActivationContext : IGrainContext /// public object GrainInstance { get; set; } = default!; - public void Migrate(Dictionary? requestContext, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException(); - /// public GrainReference GrainReference { get; set; } = default!; - /// - /// Gets or sets the grain type used for this test context. - /// + /// Gets or sets the grain type used for this test context. public Type GrainType { get; set; } = default!; /// @@ -46,28 +38,36 @@ public sealed class TestGrainActivationContext : IGrainContext /// public void Activate(Dictionary requestContext, CancellationToken? cancellationToken = null) => throw new NotImplementedException(); + public void Activate(Dictionary? requestContext, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException(); + /// public void Deactivate(DeactivationReason deactivationReason, CancellationToken? cancellationToken = null) => throw new NotImplementedException(); + public void Deactivate(DeactivationReason deactivationReason, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException(); + /// public bool Equals(IGrainContext? other) => ReferenceEquals(this, other); /// public TComponent GetComponent() where TComponent : class => throw new NotImplementedException(); + /// + public object? GetComponent(Type componentType) => throw new NotImplementedException(); + /// public TTarget GetTarget() where TTarget : class => throw new NotImplementedException(); + /// + public object? GetTarget() => throw new NotImplementedException(); + + public void Migrate(Dictionary? requestContext, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException(); + /// public void Migrate(Dictionary requestContext, CancellationToken? cancellationToken = null) => throw new NotImplementedException(); /// public void ReceiveMessage(object message) => throw new NotImplementedException(); - public void Activate(Dictionary? requestContext, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException(); - - public void Deactivate(DeactivationReason deactivationReason, CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException(); - /// public void Rehydrate(IRehydrationContext context) => throw new NotImplementedException(); diff --git a/src/OrleansTestKit/TestGrainFactory.cs b/src/OrleansTestKit/TestGrainFactory.cs index 00a0023..397ac91 100644 --- a/src/OrleansTestKit/TestGrainFactory.cs +++ b/src/OrleansTestKit/TestGrainFactory.cs @@ -1,5 +1,4 @@ using Moq; -using Orleans.Runtime; namespace Orleans.TestKit; @@ -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 AddProbe(IdSpan identity, string? grainClassNamePrefix = null) - where T : class, IGrain + where T : class, IGrain { var key = GetKey(identity, typeof(T), grainClassNamePrefix); var mock = new Mock(); diff --git a/test/OrleansTestKit.Tests/OrleansTestKit.Tests.csproj b/test/OrleansTestKit.Tests/OrleansTestKit.Tests.csproj index ce9cc51..f4cd324 100644 --- a/test/OrleansTestKit.Tests/OrleansTestKit.Tests.csproj +++ b/test/OrleansTestKit.Tests/OrleansTestKit.Tests.csproj @@ -14,7 +14,7 @@ - + From de8ce0b9123e93258927a7eeb9af63f09fa616c2 Mon Sep 17 00:00:00 2001 From: Kyle Dodson Date: Sat, 7 Mar 2026 16:41:35 -0800 Subject: [PATCH 2/2] Update README for Orleans 10 support and upgrade project dependencies --- Directory.Build.props | 4 ++-- LICENSE | 2 +- OrleansTestKit.sln | 4 ++-- README.md | 10 ++++++++-- global.json | 2 +- src/OrleansTestKit/OrleansTestKit.csproj | 4 ++-- .../OrleansTestKit.Tests.csproj | 19 ++++++++++--------- .../OrleansTestKit.Tests/Tests/LoggerTests.cs | 1 - 8 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index e34fac6..18b76f3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,7 +8,7 @@ dsarfati,seniorquico Orleans TestKit - Copyright © 2017-2021 Daniel Sarfati. 2021-2025 Kyle Dodson. All rights reserved. + Copyright © 2017-2021 Daniel Sarfati. 2021-2026 Kyle Dodson. All rights reserved. @@ -17,7 +17,7 @@ enable latest enable - net8.0 + net8.0;net10.0 latest-Recommended diff --git a/LICENSE b/LICENSE index 730bbcf..c22aed5 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/OrleansTestKit.sln b/OrleansTestKit.sln index 691caee..8626227 100644 --- a/OrleansTestKit.sln +++ b/OrleansTestKit.sln @@ -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 diff --git a/README.md b/README.md index 153c842..cc268e5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/global.json b/global.json index 7684d4f..b9353ac 100644 --- a/global.json +++ b/global.json @@ -2,6 +2,6 @@ "sdk": { "allowPrerelease": false, "rollForward": "latestFeature", - "version": "9.0.306" + "version": "10.0.103" } } diff --git a/src/OrleansTestKit/OrleansTestKit.csproj b/src/OrleansTestKit/OrleansTestKit.csproj index a06708a..7aa1523 100644 --- a/src/OrleansTestKit/OrleansTestKit.csproj +++ b/src/OrleansTestKit/OrleansTestKit.csproj @@ -30,11 +30,11 @@ - + all runtime; build; native; contentfiles; analyzers - + all runtime; build; native; contentfiles; analyzers diff --git a/test/OrleansTestKit.Tests/OrleansTestKit.Tests.csproj b/test/OrleansTestKit.Tests/OrleansTestKit.Tests.csproj index f4cd324..0774e2b 100644 --- a/test/OrleansTestKit.Tests/OrleansTestKit.Tests.csproj +++ b/test/OrleansTestKit.Tests/OrleansTestKit.Tests.csproj @@ -2,24 +2,25 @@ + Exe Orleans.TestKit.Tests - + all runtime; build; native; contentfiles; analyzers - - - - - + + + + + - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/OrleansTestKit.Tests/Tests/LoggerTests.cs b/test/OrleansTestKit.Tests/Tests/LoggerTests.cs index de3f639..7375fac 100644 --- a/test/OrleansTestKit.Tests/Tests/LoggerTests.cs +++ b/test/OrleansTestKit.Tests/Tests/LoggerTests.cs @@ -2,7 +2,6 @@ using TestGrains; using TestInterfaces; using Xunit; -using Xunit.Abstractions; namespace Orleans.TestKit.Tests;