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
28 changes: 28 additions & 0 deletions .github/workflows/benchmarks-ab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Benchmarks A/B

on:
workflow_dispatch:
inputs:
base:
description: 'Baseline commit SHA.'
type: string
required: true
head:
description: 'Commit SHA compared against the baseline.'
type: string
required: true

permissions:
contents: read

jobs:
benchmark:
uses: reactiveui/actions-common/.github/workflows/workflow-common-benchmarks-ab.yml@main
with:
base: ${{ inputs.base }}
head: ${{ inputs.head }}
projects: |
benchmarks/ReactiveUI.Binding.Benchmarks/ReactiveUI.Binding.Benchmarks.csproj
benchmarks/ReactiveUI.Binding.Generator.Benchmarks/ReactiveUI.Binding.Generator.Benchmarks.csproj
solutionFile: ReactiveUI.Binding.SourceGenerators.slnx
installWorkloads: true
6 changes: 6 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Benchmarks

on:
workflow_dispatch:
inputs:
sha:
description: 'Commit to benchmark. Empty benchmarks the latest commit of the chosen branch.'
type: string
default: ''

permissions:
contents: read
Expand All @@ -10,6 +15,7 @@ jobs:
benchmark:
uses: reactiveui/actions-common/.github/workflows/workflow-common-benchmarks.yml@main
with:
ref: ${{ inputs.sha }}
projects: |
benchmarks/ReactiveUI.Binding.Benchmarks/ReactiveUI.Binding.Benchmarks.csproj
benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ReactiveUI.Binding.Benchmarks.ReactiveUI.csproj
Expand Down
3 changes: 3 additions & 0 deletions src/benchmarks/Shared/Configs/BenchmarkConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Filters;
using BenchmarkDotNet.Jobs;

namespace ReactiveUI.Binding.Benchmarks.Configs;

/// <summary>Runs benchmarks on .NET 8, 10 and 11, traced with EventPipe.</summary>
/// <remarks>The filter drops the NativeAOT jobs a benchmark class adds, which <see cref="NativeAotMemoryConfig"/> runs.</remarks>
public class BenchmarkConfig : ProfilerConfig
{
/// <summary>Initializes a new instance of the <see cref="BenchmarkConfig"/> class.</summary>
Expand All @@ -20,5 +22,6 @@ public BenchmarkConfig()
_ = AddJob(new Job().WithRuntime(CoreRuntime.Core10_0));
_ = AddJob(new Job().WithRuntime(CoreRuntime.Core11_0));
_ = AddExporter(MarkdownExporter.GitHub);
_ = AddFilter(new SimpleFilter(static benchmark => !NativeAotBenchmarkConfig.IsNativeAotJob(benchmark.Job)));
}
}
20 changes: 20 additions & 0 deletions src/benchmarks/Shared/Configs/BenchmarkProfiling.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

namespace ReactiveUI.Binding.Benchmarks.Configs;

/// <summary>Reads whether the benchmark configs attach their profilers.</summary>
/// <remarks>
/// An A/B comparison measures timing only. It sets <c>BENCHMARK_PROFILERS</c> to <c>false</c>, which skips the
/// second pass each profiler adds to every benchmark.
/// </remarks>
public static class BenchmarkProfiling
{
/// <summary>The environment variable that turns the profilers off when set to <c>false</c>.</summary>
private const string VariableName = "BENCHMARK_PROFILERS";

/// <summary>Gets a value indicating whether the profilers are attached.</summary>
public static bool Enabled =>
!string.Equals(Environment.GetEnvironmentVariable(VariableName), "false", StringComparison.OrdinalIgnoreCase);
}
17 changes: 15 additions & 2 deletions src/benchmarks/Shared/Configs/NativeAotBenchmarkConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Runtime.CompilerServices;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
Expand All @@ -11,10 +12,22 @@ namespace ReactiveUI.Binding.Benchmarks.Configs;
/// <summary>Adds the NativeAOT runtimes, for benchmarks whose code publishes ahead of time.</summary>
public class NativeAotBenchmarkConfig : ManualConfig
{
/// <summary>The id of the NativeAOT 10 job.</summary>
private const string NativeAot10JobId = nameof(RuntimeMoniker.NativeAot10_0);

/// <summary>The id of the NativeAOT 11 job.</summary>
private const string NativeAot11JobId = nameof(RuntimeMoniker.NativeAot11_0);

/// <summary>Initializes a new instance of the <see cref="NativeAotBenchmarkConfig"/> class.</summary>
public NativeAotBenchmarkConfig()
{
_ = AddJob(new Job(nameof(RuntimeMoniker.NativeAot10_0)).WithRuntime(NativeAotRuntime.Net10_0));
_ = AddJob(new Job(nameof(RuntimeMoniker.NativeAot11_0)).WithRuntime(NativeAotRuntime.Net11_0));
_ = AddJob(new Job(NativeAot10JobId).WithRuntime(NativeAotRuntime.Net10_0));
_ = AddJob(new Job(NativeAot11JobId).WithRuntime(NativeAotRuntime.Net11_0));
}

/// <summary>Gets a value indicating whether a job is one of the NativeAOT jobs this config adds.</summary>
/// <param name="job">The job to check.</param>
/// <returns><see langword="true"/> for a NativeAOT job; otherwise, <see langword="false"/>.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsNativeAotJob(Job job) => job.Id is NativeAot10JobId or NativeAot11JobId;
}
29 changes: 29 additions & 0 deletions src/benchmarks/Shared/Configs/NativeAotMemoryConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Filters;

namespace ReactiveUI.Binding.Benchmarks.Configs;

/// <summary>Runs the NativeAOT jobs with the memory diagnoser.</summary>
/// <remarks>
/// EventPipe cannot attach to a NativeAOT process built with the default settings, and a run keeps one set of
/// diagnosers, so these jobs run apart from <see cref="BenchmarkConfig"/>. The filter keeps only the NativeAOT jobs
/// a benchmark class adds through <see cref="NativeAotBenchmarkConfig"/>.
/// </remarks>
public class NativeAotMemoryConfig : ManualConfig
{
/// <summary>Initializes a new instance of the <see cref="NativeAotMemoryConfig"/> class.</summary>
public NativeAotMemoryConfig()
{
Add(DefaultConfig.Instance);
_ = AddDiagnoser(MemoryDiagnoser.Default);
_ = AddExporter(MarkdownExporter.GitHub);
_ = AddFilter(new SimpleFilter(static benchmark => NativeAotBenchmarkConfig.IsNativeAotJob(benchmark.Job)));
_ = WithOption(ConfigOptions.DontOverwriteResults, true);
}
}
5 changes: 5 additions & 0 deletions src/benchmarks/Shared/Configs/ProfilerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public class ProfilerConfig : ManualConfig
/// <summary>Initializes a new instance of the <see cref="ProfilerConfig"/> class.</summary>
public ProfilerConfig()
{
if (!BenchmarkProfiling.Enabled)
{
return;
}

EventPipeProvider[] providers =
[
new(SampleProfilerProviderName, EventLevel.Informational),
Expand Down
10 changes: 7 additions & 3 deletions src/benchmarks/Shared/Platforms/unix/BenchmarkHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@

namespace ReactiveUI.Binding.Benchmarks.Configs;

/// <summary>Runs the benchmarks on .NET with EventPipe.</summary>
/// <summary>Runs the benchmarks on .NET with EventPipe, and on NativeAOT with the memory diagnoser.</summary>
public static class BenchmarkHost
{
/// <summary>Runs the benchmarks the command line selects.</summary>
/// <param name="assembly">The assembly holding the benchmarks.</param>
/// <param name="args">The command line arguments passed to the benchmark switcher.</param>
public static void Run(Assembly assembly, string[] args) =>
_ = BenchmarkSwitcher.FromAssembly(assembly).Run(args, new BenchmarkConfig());
public static void Run(Assembly assembly, string[] args)
{
var switcher = BenchmarkSwitcher.FromAssembly(assembly);
_ = switcher.Run(args, new BenchmarkConfig());
_ = switcher.Run(args, new NativeAotMemoryConfig());
}
}
3 changes: 2 additions & 1 deletion src/benchmarks/Shared/Platforms/windows/BenchmarkHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace ReactiveUI.Binding.Benchmarks.Configs;

/// <summary>Runs the benchmarks on .NET with EventPipe, then on .NET Framework with ETW.</summary>
/// <summary>Runs the benchmarks on .NET with EventPipe, on .NET Framework with ETW, and on NativeAOT with the memory diagnoser.</summary>
public static class BenchmarkHost
{
/// <summary>Runs the benchmarks the command line selects.</summary>
Expand All @@ -18,5 +18,6 @@ public static void Run(Assembly assembly, string[] args)
var switcher = BenchmarkSwitcher.FromAssembly(assembly);
_ = switcher.Run(args, new BenchmarkConfig());
_ = switcher.Run(args, new NetFrameworkConfig());
_ = switcher.Run(args, new NativeAotMemoryConfig());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ public NetFrameworkConfig()
{
Add(DefaultConfig.Instance);
_ = AddJob(new Job(NetFrameworkJobId).WithRuntime(ClrRuntime.Net462));
_ = AddDiagnoser(new EtwProfiler(new EtwProfilerConfig()));
_ = AddExporter(MarkdownExporter.GitHub);
_ = AddFilter(new SimpleFilter(static benchmark => benchmark.Job.Id == NetFrameworkJobId));
_ = WithOption(ConfigOptions.DontOverwriteResults, true);

if (BenchmarkProfiling.Enabled)
{
_ = AddDiagnoser(new EtwProfiler(new EtwProfilerConfig()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Runtime.CompilerServices;

namespace ReactiveUI.Binding.Tests.Interactions;

/// <summary>Tests for <see cref="Interaction{TInput, TOutput}"/>.</summary>
Expand All @@ -10,6 +12,9 @@
/// <summary>The result the first registered handler produces.</summary>
private const string FirstHandlerResult = "first";

/// <summary>The result the second registered handler produces.</summary>
private const string SecondHandlerResult = "second";

/// <summary>The expected output of the synchronous handler (the length of "hello").</summary>
private const int HelloLength = 5;

Expand Down Expand Up @@ -70,10 +75,27 @@
{
var interaction = new Interaction<string, string>();
using var first = interaction.RegisterHandler(static ctx => ctx.SetOutput(FirstHandlerResult));
using var second = interaction.RegisterHandler(static ctx => ctx.SetOutput("second"));
using var second = interaction.RegisterHandler(static ctx => ctx.SetOutput(SecondHandlerResult));

var result = await interaction.Handle("input");

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)

Check failure on line 80 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

The literal "input" appears 3 times in this file; give it a name once (https://github.com/glennawatson/RoslynCommonAnalyzers/blob/main/docs/rules/SST1486.md)
await Assert.That(result).IsEqualTo("second");
await Assert.That(result).IsEqualTo(SecondHandlerResult);
}

/// <summary>Verifies that GetHandlers hands back a copy, so changing it leaves the registered handlers alone.</summary>
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
[Test]
public async Task GetHandlers_ReturnsACopyOfTheRegisteredHandlers()
{
var interaction = new HandlerListingInteraction();
using var first = interaction.RegisterHandler(static ctx => ctx.SetOutput(FirstHandlerResult));
using var second = interaction.RegisterHandler(static ctx => ctx.SetOutput(SecondHandlerResult));

var handlers = interaction.ListHandlers();
Array.Clear(handlers);

await Assert.That(interaction.ListHandlers().Length).IsEqualTo(2);

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (ubuntu-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-unix (macos-latest)

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / build / build-windows

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / sonarcloud / sonarcloud

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

Check failure on line 96 in src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs

View workflow job for this annotation

GitHub Actions / codeql / Analyze C#

await Assert.That(interaction.ListHandlers()[1]).IsNotNull();
await Assert.That(await interaction.Handle("input")).IsEqualTo(SecondHandlerResult);
}

/// <summary>Verifies that Handle throws UnhandledInteractionException when no handler calls SetOutput.</summary>
Expand Down Expand Up @@ -190,4 +212,13 @@
return EmptyDisposable.Instance;
}
}

/// <summary>An interaction that exposes its protected handler list to the tests.</summary>
private sealed class HandlerListingInteraction : Interaction<string, string>
{
/// <summary>Lists the registered handlers.</summary>
/// <returns>The registered handlers, in registration order.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Func<IInteractionContext<string, string>, Task>[] ListHandlers() => GetHandlers();
}
}
Loading