feat: create request projects for basic CQRS
This commit is contained in:
commit
d614788e06
190 changed files with 12236 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class AmbiguousScalarHandler : IScalarRequestHandler<AmbiguousScalarRequest, string>
|
||||
{
|
||||
// Public method with the same name and signature
|
||||
public Task<string> HandleAsync(AmbiguousScalarRequest request, CancellationToken ct)
|
||||
{
|
||||
return Task.FromResult("Public-Handled");
|
||||
}
|
||||
|
||||
// Explicit interface implementation
|
||||
Task<string> IScalarRequestHandler<AmbiguousScalarRequest, string>.HandleAsync(AmbiguousScalarRequest request, CancellationToken ct)
|
||||
{
|
||||
return Task.FromResult("Interface-Handled");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class AmbiguousScalarRequest : IScalarRequest<string>
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class AmbiguousStreamHandler : IStreamRequestHandler<AmbiguousStreamRequest, string>
|
||||
{
|
||||
// Public method with the same name and signature
|
||||
public async IAsyncEnumerable<string> HandleAsync(AmbiguousStreamRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return "Public-Handled";
|
||||
}
|
||||
|
||||
// Explicit interface implementation
|
||||
async IAsyncEnumerable<string> IStreamRequestHandler<AmbiguousStreamRequest, string>.HandleAsync(AmbiguousStreamRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return "Interface-Handled";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class AmbiguousStreamRequest : IStreamRequest<string>
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class AnotherNamedScalarRequest : INamedScalarRequest
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class AnotherNamedStreamRequest : INamedStreamRequest
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
12
src/request.dispatcher.tests/_fixtures/AnotherTestHandler.cs
Normal file
12
src/request.dispatcher.tests/_fixtures/AnotherTestHandler.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
internal sealed class AnotherTestHandler : IScalarRequestHandler<AnotherTestRequest, string>
|
||||
{
|
||||
public Task<string> HandleAsync(AnotherTestRequest request, CancellationToken ct)
|
||||
{
|
||||
return Task.FromResult("ok");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
internal sealed class AnotherTestRequest : IScalarRequest<string> { }
|
||||
10
src/request.dispatcher.tests/_fixtures/BaseScalarHandler.cs
Normal file
10
src/request.dispatcher.tests/_fixtures/BaseScalarHandler.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public abstract class BaseScalarHandler<TRequest> : IScalarRequestHandler<TRequest, string>
|
||||
where TRequest : IScalarRequest<string>
|
||||
{
|
||||
public abstract Task<string> HandleAsync(TRequest request, CancellationToken cancellationToken);
|
||||
}
|
||||
10
src/request.dispatcher.tests/_fixtures/BaseStreamHandler.cs
Normal file
10
src/request.dispatcher.tests/_fixtures/BaseStreamHandler.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public abstract class BaseStreamHandler<TRequest> : IStreamRequestHandler<TRequest, string>
|
||||
where TRequest : IStreamRequest<string>
|
||||
{
|
||||
public abstract IAsyncEnumerable<string> HandleAsync(TRequest request, CancellationToken cancellationToken);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ConstrainedScalarHandler<TRequest> : IScalarRequestHandler<TRequest, string>
|
||||
where TRequest : ConstrainedScalarRequest
|
||||
{
|
||||
public Task<string> HandleAsync(TRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult($"{request.Value}-Constrained");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ConstrainedScalarRequest : IScalarRequest<string>
|
||||
{
|
||||
public int Value { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ConstrainedStreamHandler<TRequest> : IStreamRequestHandler<TRequest, string>
|
||||
where TRequest : ConstrainedStreamRequest
|
||||
{
|
||||
public async IAsyncEnumerable<string> HandleAsync(TRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return $"{request.Value}-Constrained-0";
|
||||
yield return $"{request.Value}-Constrained-1";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ConstrainedStreamRequest : IStreamRequest<string>
|
||||
{
|
||||
public int Value { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class DeepDerivedScalarRequest : InheritedScalarRequest
|
||||
{
|
||||
public int DeepValue { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class DeepDerivedStreamRequest : InheritedStreamRequest
|
||||
{
|
||||
public int DeepValue { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class DerivedScalarHandler : BaseScalarHandler<DerivedScalarRequest>
|
||||
{
|
||||
public override Task<string> HandleAsync(DerivedScalarRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult($"Derived: {request.Value}");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class DerivedScalarRequest : IScalarRequest<string>
|
||||
{
|
||||
public int Value { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class DerivedStreamHandler : BaseStreamHandler<DerivedStreamRequest>
|
||||
{
|
||||
public override async IAsyncEnumerable<string> HandleAsync(DerivedStreamRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return $"Derived: {request.Value}-0";
|
||||
yield return $"Derived: {request.Value}-1";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class DerivedStreamRequest : IStreamRequest<string>
|
||||
{
|
||||
public int Value { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ExplicitGenericScalarHandler<T> : IScalarRequestHandler<ExplicitGenericScalarRequest, string>
|
||||
{
|
||||
Task<string> IScalarRequestHandler<ExplicitGenericScalarRequest, string>.HandleAsync(ExplicitGenericScalarRequest request, CancellationToken ct)
|
||||
{
|
||||
return Task.FromResult($"{request.Value}-ExplicitHandled");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ExplicitGenericScalarRequest : IScalarRequest<string>
|
||||
{
|
||||
public string Value { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ExplicitGenericStreamHandler<T> : IStreamRequestHandler<ExplicitGenericStreamRequest, string>
|
||||
{
|
||||
async IAsyncEnumerable<string> IStreamRequestHandler<ExplicitGenericStreamRequest, string>.HandleAsync(ExplicitGenericStreamRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken ct)
|
||||
{
|
||||
yield return $"{request.Value}-ExplicitHandled";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ExplicitGenericStreamRequest : IStreamRequest<string>
|
||||
{
|
||||
public string Value { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class FailingScalarHandler : IScalarRequestHandler<FailingScalarRequest, string>
|
||||
{
|
||||
public Task<string> HandleAsync(FailingScalarRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new InvalidOperationException("Handler failed");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class FailingScalarRequest : IScalarRequest<string>
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class FailingStreamHandler : IStreamRequestHandler<FailingStreamRequest, string>
|
||||
{
|
||||
public async IAsyncEnumerable<string> HandleAsync(FailingStreamRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return "Wait for it...";
|
||||
throw new InvalidOperationException("Handler failed");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class FailingStreamRequest : IStreamRequest<string>
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public interface INamedScalarRequest : IScalarRequest<string>
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public interface INamedStreamRequest : IStreamRequest<string>
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class InheritedScalarRequest : OpenScalarRequest
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class InheritedStreamRequest : OpenStreamRequest
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class InterfaceConstrainedScalarHandler<TRequest> : IScalarRequestHandler<TRequest, string>
|
||||
where TRequest : INamedScalarRequest
|
||||
{
|
||||
public Task<string> HandleAsync(TRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult($"{request.Name}-ConstrainedByInterface");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class InterfaceConstrainedStreamHandler<TRequest> : IStreamRequestHandler<TRequest, string>
|
||||
where TRequest : INamedStreamRequest
|
||||
{
|
||||
public async IAsyncEnumerable<string> HandleAsync(TRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return $"{request.Name}-ConstrainedByInterface-0";
|
||||
yield return $"{request.Name}-ConstrainedByInterface-1";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class InterfaceInheritedScalarHandler : IScalarRequestHandler<InterfaceInheritedScalarRequest, string>
|
||||
{
|
||||
public Task<string> HandleAsync(InterfaceInheritedScalarRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult($"{request.Name}-InterfaceHandled");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class InterfaceInheritedScalarRequest : INamedScalarRequest
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class InterfaceInheritedStreamHandler : IStreamRequestHandler<InterfaceInheritedStreamRequest, string>
|
||||
{
|
||||
public async IAsyncEnumerable<string> HandleAsync(InterfaceInheritedStreamRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return $"{request.Name}-InterfaceHandled-0";
|
||||
yield return $"{request.Name}-InterfaceHandled-1";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class InterfaceInheritedStreamRequest : INamedStreamRequest
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class MultiInterfaceScalarHandler : IScalarRequestHandler<MultiInterfaceScalarRequest, int>, IScalarRequestHandler<MultiInterfaceScalarRequest, string>
|
||||
{
|
||||
public Task<int> HandleAsync(MultiInterfaceScalarRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult(1);
|
||||
}
|
||||
|
||||
Task<string> IScalarRequestHandler<MultiInterfaceScalarRequest, string>.HandleAsync(MultiInterfaceScalarRequest request, CancellationToken ct)
|
||||
{
|
||||
return Task.FromResult("One");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class MultiInterfaceScalarRequest : IScalarRequest<int>, IScalarRequest<string>
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class MultiInterfaceStreamHandler : IStreamRequestHandler<MultiInterfaceStreamRequest, int>, IStreamRequestHandler<MultiInterfaceStreamRequest, string>
|
||||
{
|
||||
public async IAsyncEnumerable<int> HandleAsync(MultiInterfaceStreamRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return 1;
|
||||
yield return 2;
|
||||
}
|
||||
|
||||
async IAsyncEnumerable<string> IStreamRequestHandler<MultiInterfaceStreamRequest, string>.HandleAsync(MultiInterfaceStreamRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken ct)
|
||||
{
|
||||
yield return "One";
|
||||
yield return "Two";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class MultiInterfaceStreamRequest : IStreamRequest<int>, IStreamRequest<string>
|
||||
{
|
||||
}
|
||||
13
src/request.dispatcher.tests/_fixtures/OpenScalarHandler.cs
Normal file
13
src/request.dispatcher.tests/_fixtures/OpenScalarHandler.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class OpenScalarHandler<TRequest> : IScalarRequestHandler<TRequest, string>
|
||||
where TRequest : OpenScalarRequest
|
||||
{
|
||||
public Task<string> HandleAsync(TRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult($"{request.Data}-Handled");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class OpenScalarRequest : IScalarRequest<string>
|
||||
{
|
||||
public string Data { get; set; } = string.Empty;
|
||||
}
|
||||
14
src/request.dispatcher.tests/_fixtures/OpenStreamHandler.cs
Normal file
14
src/request.dispatcher.tests/_fixtures/OpenStreamHandler.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class OpenStreamHandler<TRequest> : IStreamRequestHandler<TRequest, string>
|
||||
where TRequest : OpenStreamRequest
|
||||
{
|
||||
public async IAsyncEnumerable<string> HandleAsync(TRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return $"{request.Data}-Stream-0";
|
||||
yield return $"{request.Data}-Stream-1";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class OpenStreamRequest : IStreamRequest<string>
|
||||
{
|
||||
public string Data { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarChainedBehaviour1(ScalarTestTracker tracker) : IScalarRequestBehavior<ScalarTestRequest, string>
|
||||
{
|
||||
public async Task<string> HandleAsync(ScalarTestRequest request, ScalarHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Log.Add("Behaviour1");
|
||||
return await next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarChainedBehaviour2(ScalarTestTracker tracker) : IScalarRequestBehavior<ScalarTestRequest, string>
|
||||
{
|
||||
public async Task<string> HandleAsync(ScalarTestRequest request, ScalarHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Log.Add("Behaviour2");
|
||||
return await next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
14
src/request.dispatcher.tests/_fixtures/ScalarOpenBehavior.cs
Normal file
14
src/request.dispatcher.tests/_fixtures/ScalarOpenBehavior.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarOpenBehavior<TRequest, TResponse>(ScalarTestTracker tracker) : IScalarRequestBehavior<TRequest, TResponse>
|
||||
where TRequest : IScalarRequest<TResponse>
|
||||
{
|
||||
public async Task<TResponse> HandleAsync(TRequest request, ScalarHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Executed = true;
|
||||
return await next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarOrderingClosedBehavior(ScalarTestTracker tracker) : IScalarRequestBehavior<ScalarTestRequest, string>
|
||||
{
|
||||
public Task<string> HandleAsync(ScalarTestRequest request, ScalarHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Log.Add("OrderingClosed");
|
||||
return next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarOrderingOpenBehavior<TRequest, TOutput>(ScalarTestTracker tracker) : IScalarRequestBehavior<TRequest, TOutput>
|
||||
where TRequest : IScalarRequest<TOutput>
|
||||
{
|
||||
public Task<TOutput> HandleAsync(TRequest request, ScalarHandlerDelegate<TOutput> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Log.Add("OrderingOpen");
|
||||
return next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
13
src/request.dispatcher.tests/_fixtures/ScalarTestBehavior.cs
Normal file
13
src/request.dispatcher.tests/_fixtures/ScalarTestBehavior.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarTestBehavior(ScalarTestTracker tracker) : IScalarRequestBehavior<ScalarTestRequest, string>
|
||||
{
|
||||
public async Task<string> HandleAsync(ScalarTestRequest request, ScalarHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Executed = true;
|
||||
return await next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
12
src/request.dispatcher.tests/_fixtures/ScalarTestHandler.cs
Normal file
12
src/request.dispatcher.tests/_fixtures/ScalarTestHandler.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarTestHandler : IScalarRequestHandler<ScalarTestRequest, string>
|
||||
{
|
||||
public Task<string> HandleAsync(ScalarTestRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult($"{request.Value}-Handled");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarTestRequest : IScalarRequest<string>
|
||||
{
|
||||
public string Value { get; set; } = string.Empty;
|
||||
}
|
||||
10
src/request.dispatcher.tests/_fixtures/ScalarTestTracker.cs
Normal file
10
src/request.dispatcher.tests/_fixtures/ScalarTestTracker.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarTestTracker
|
||||
{
|
||||
public List<string> Log { get; } = [];
|
||||
public bool Executed { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarTestWrapperHandler<T> : IScalarRequestHandler<ScalarTestWrapperRequest<T>, string>
|
||||
{
|
||||
public Task<string> HandleAsync(ScalarTestWrapperRequest<T> request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult($"Handled-{request.Item}");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarTestWrapperRequest<T> : IScalarRequest<string>
|
||||
{
|
||||
public T Item { get; set; } = default!;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class ScalarWrapperBehavior<T>(ScalarTestTracker tracker) : IScalarRequestBehavior<ScalarTestWrapperRequest<T>, string>
|
||||
{
|
||||
public async Task<string> HandleAsync(ScalarTestWrapperRequest<T> request, ScalarHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Executed = true;
|
||||
return await next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamChainedBehaviour1(StreamTestTracker tracker) : IStreamRequestBehavior<StreamTestRequest, string>
|
||||
{
|
||||
public IAsyncEnumerable<string> HandleAsync(StreamTestRequest request, StreamHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Log.Add("Behaviour1");
|
||||
return next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamChainedBehaviour2(StreamTestTracker tracker) : IStreamRequestBehavior<StreamTestRequest, string>
|
||||
{
|
||||
public IAsyncEnumerable<string> HandleAsync(StreamTestRequest request, StreamHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Log.Add("Behaviour2");
|
||||
return next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
14
src/request.dispatcher.tests/_fixtures/StreamOpenBehavior.cs
Normal file
14
src/request.dispatcher.tests/_fixtures/StreamOpenBehavior.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamOpenBehavior<TRequest, TResponse>(StreamTestTracker tracker) : IStreamRequestBehavior<TRequest, TResponse>
|
||||
where TRequest : IStreamRequest<TResponse>
|
||||
{
|
||||
public IAsyncEnumerable<TResponse> HandleAsync(TRequest request, StreamHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Executed = true;
|
||||
return next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamOrderingClosedBehavior(StreamTestTracker tracker) : IStreamRequestBehavior<StreamTestRequest, string>
|
||||
{
|
||||
public IAsyncEnumerable<string> HandleAsync(StreamTestRequest request, StreamHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Log.Add("Closed");
|
||||
return next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamOrderingOpenBehavior<TRequest, TOutput>(StreamTestTracker tracker) : IStreamRequestBehavior<TRequest, TOutput>
|
||||
where TRequest : IStreamRequest<TOutput>
|
||||
{
|
||||
public IAsyncEnumerable<TOutput> HandleAsync(TRequest request, StreamHandlerDelegate<TOutput> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Log.Add("Open");
|
||||
return next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
13
src/request.dispatcher.tests/_fixtures/StreamTestBehavior.cs
Normal file
13
src/request.dispatcher.tests/_fixtures/StreamTestBehavior.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamTestBehavior(StreamTestTracker tracker) : IStreamRequestBehavior<StreamTestRequest, string>
|
||||
{
|
||||
public IAsyncEnumerable<string> HandleAsync(StreamTestRequest request, StreamHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Executed = true;
|
||||
return next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
13
src/request.dispatcher.tests/_fixtures/StreamTestHandler.cs
Normal file
13
src/request.dispatcher.tests/_fixtures/StreamTestHandler.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamTestHandler : IStreamRequestHandler<StreamTestRequest, string>
|
||||
{
|
||||
public async IAsyncEnumerable<string> HandleAsync(StreamTestRequest request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return $"{request.Value}-Handled-0";
|
||||
yield return $"{request.Value}-Handled-1";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamTestRequest : IStreamRequest<string>
|
||||
{
|
||||
public string Value { get; set; } = string.Empty;
|
||||
}
|
||||
10
src/request.dispatcher.tests/_fixtures/StreamTestTracker.cs
Normal file
10
src/request.dispatcher.tests/_fixtures/StreamTestTracker.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamTestTracker
|
||||
{
|
||||
public List<string> Log { get; } = [];
|
||||
public bool Executed { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamTestWrapperHandler<T> : IStreamRequestHandler<StreamTestWrapperRequest<T>, string>
|
||||
{
|
||||
public async IAsyncEnumerable<string> HandleAsync(StreamTestWrapperRequest<T> request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return $"Handled-{request.Item}-0";
|
||||
yield return $"Handled-{request.Item}-1";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamTestWrapperRequest<T> : IStreamRequest<string>
|
||||
{
|
||||
public T? Item { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class StreamWrapperBehavior<T>(StreamTestTracker tracker) : IStreamRequestBehavior<StreamTestWrapperRequest<T>, string>
|
||||
{
|
||||
public IAsyncEnumerable<string> HandleAsync(StreamTestWrapperRequest<T> request, StreamHandlerDelegate<string> next, CancellationToken cancellationToken)
|
||||
{
|
||||
tracker.Executed = true;
|
||||
return next(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
12
src/request.dispatcher.tests/_fixtures/TestHandler.cs
Normal file
12
src/request.dispatcher.tests/_fixtures/TestHandler.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
internal sealed class TestHandler : IScalarRequestHandler<TestRequest, string>
|
||||
{
|
||||
public Task<string> HandleAsync(TestRequest request, CancellationToken ct)
|
||||
{
|
||||
return Task.FromResult("ok");
|
||||
}
|
||||
}
|
||||
6
src/request.dispatcher.tests/_fixtures/TestRequest.cs
Normal file
6
src/request.dispatcher.tests/_fixtures/TestRequest.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
internal sealed class TestRequest : IScalarRequest<string> { }
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class UnhandledScalarRequest : IScalarRequest<string>
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class UnhandledStreamRequest : IStreamRequest<string>
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class WrapperScalarHandler<T> : IScalarRequestHandler<WrapperScalarRequest<T>, string>
|
||||
{
|
||||
public Task<string> HandleAsync(WrapperScalarRequest<T> request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult($"Handled-{request.Item}");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class WrapperScalarRequest<T> : IScalarRequest<string>
|
||||
{
|
||||
public T Item { get; set; } = default!;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class WrapperStreamHandler<T> : IStreamRequestHandler<WrapperStreamRequest<T>, string>
|
||||
{
|
||||
public async IAsyncEnumerable<string> HandleAsync(WrapperStreamRequest<T> request, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
yield return $"Handled-{request.Item}-0";
|
||||
yield return $"Handled-{request.Item}-1";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher.Tests;
|
||||
|
||||
public class WrapperStreamRequest<T> : IStreamRequest<string>
|
||||
{
|
||||
public T Item { get; set; } = default!;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Geekeey.Request.Dispatcher;
|
||||
|
||||
namespace Sample;
|
||||
|
||||
public sealed class Ping : IScalarRequest<string>
|
||||
{
|
||||
}
|
||||
|
||||
public sealed class Container
|
||||
{
|
||||
public sealed class PingHandler : IScalarRequestHandler<Ping, string>
|
||||
{
|
||||
public Task<string> HandleAsync(Ping request, CancellationToken cancellationToken) => Task.FromResult("pong");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Geekeey.Request.Dispatcher;
|
||||
|
||||
namespace Sample;
|
||||
|
||||
public sealed class Ping : IScalarRequest<string>
|
||||
{
|
||||
}
|
||||
|
||||
public sealed class Container
|
||||
{
|
||||
public sealed class PingHandler : IScalarRequestHandler<Ping, string>
|
||||
{
|
||||
public Task<string> HandleAsync(Ping request, CancellationToken cancellationToken) => Task.FromResult("pong");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Geekeey.Request.Dispatcher;
|
||||
|
||||
namespace Sample;
|
||||
|
||||
public sealed class Ping : IScalarRequest<string>
|
||||
{
|
||||
}
|
||||
|
||||
public sealed class PingHandler : IScalarRequestHandler<Ping, string>
|
||||
{
|
||||
public Task<string> HandleAsync(Ping request, CancellationToken cancellationToken) => Task.FromResult("pong");
|
||||
}
|
||||
Loading…
Reference in a new issue