From 019f23c6df57c2d7ea2d872ffd86706e3d2a4359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Sat, 8 Nov 2025 22:49:54 +0100 Subject: [PATCH 1/3] Add failing test --- .../ThatEnumerable.All.ComplyWith.Tests.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs b/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs index 77664c55c..18106fd12 100644 --- a/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs +++ b/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using System.Threading; // ReSharper disable PossibleMultipleEnumeration @@ -13,6 +14,30 @@ public sealed partial class ComplyWith { public sealed class Tests { +#if NET8_0_OR_GREATER + [Theory] + [AutoData] + public async Task GenerateRandom_NextBytes_WithSmallerBuffer_ShouldReturnPartlyInitializedBytes( + int seed, byte[] value) + { + List results = []; + + Random random = Random.Shared; + for (int i = 0; i < 100; i++) + { + byte[] buffer = new byte[value.Length + 1]; + random.NextBytes(buffer); + results.Add(buffer); + } + + byte[] expected = value.Concat(new[] + { + (byte)0, + }).ToArray(); + + await That(results).All().ComplyWith(v => v.IsEqualTo(expected)); + } +#endif [Fact] public async Task ConsidersCancellationToken() { From 5fed3c62fa5e12fb1fa6f0260f972de02550b674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Sat, 8 Nov 2025 23:05:07 +0100 Subject: [PATCH 2/3] fix: infinite loop in result contexts --- Source/aweXpect.Core/Core/ResultContexts.cs | 4 ++-- .../ThatEnumerable.All.ComplyWith.Tests.cs | 24 ------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/Source/aweXpect.Core/Core/ResultContexts.cs b/Source/aweXpect.Core/Core/ResultContexts.cs index 9d05615fe..44e2a8586 100644 --- a/Source/aweXpect.Core/Core/ResultContexts.cs +++ b/Source/aweXpect.Core/Core/ResultContexts.cs @@ -57,8 +57,8 @@ public ResultContexts Add(ResultContext context) } else { - context._next = _first._next; - _first._next = context; + context._next = _first; + _first = context; } } diff --git a/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs b/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs index 18106fd12..598107c1a 100644 --- a/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs +++ b/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs @@ -14,30 +14,6 @@ public sealed partial class ComplyWith { public sealed class Tests { -#if NET8_0_OR_GREATER - [Theory] - [AutoData] - public async Task GenerateRandom_NextBytes_WithSmallerBuffer_ShouldReturnPartlyInitializedBytes( - int seed, byte[] value) - { - List results = []; - - Random random = Random.Shared; - for (int i = 0; i < 100; i++) - { - byte[] buffer = new byte[value.Length + 1]; - random.NextBytes(buffer); - results.Add(buffer); - } - - byte[] expected = value.Concat(new[] - { - (byte)0, - }).ToArray(); - - await That(results).All().ComplyWith(v => v.IsEqualTo(expected)); - } -#endif [Fact] public async Task ConsidersCancellationToken() { From d5dfe7b95c10f5725df090114d6907f0672136d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Sat, 8 Nov 2025 23:06:24 +0100 Subject: [PATCH 3/3] Remove unused using --- .../Collections/ThatEnumerable.All.ComplyWith.Tests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs b/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs index 598107c1a..77664c55c 100644 --- a/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs +++ b/Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using System.Threading; // ReSharper disable PossibleMultipleEnumeration