Skip to content

Commit

Permalink
Someone from FluentAssertions forgot to assert that license.Should().…
Browse files Browse the repository at this point in the history
…BeFree() so welcome back Shouldly
  • Loading branch information
blankensteiner committed Jan 27, 2025
1 parent c67a674 commit 0916a5d
Show file tree
Hide file tree
Showing 27 changed files with 242 additions and 242 deletions.
4 changes: 2 additions & 2 deletions tests/DotPulsar.Tests/DotPulsar.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</PropertyGroup>

<ItemGroup>
<Using Include="FluentAssertions" />
<Using Include="NSubstitute" />
<Using Include="Shouldly" />
<Using Include="Xunit" />
</ItemGroup>

Expand All @@ -21,11 +21,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="7.1.0" />
<PackageReference Include="IronSnappy" Version="1.3.1" />
<PackageReference Include="K4os.Compression.LZ4" Version="1.3.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="Testcontainers" Version="4.1.0" />
<PackageReference Include="Testcontainers.Pulsar" Version="4.1.0" />
<PackageReference Include="ToxiproxyNetCore" Version="1.0.35" />
Expand Down
4 changes: 2 additions & 2 deletions tests/DotPulsar.Tests/Extensions/ReceiveExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task TryReceive_GivenTopicWithMessages_ShouldReturnTrue()
var actual = receiver.TryReceive(out var message);

//Assert
actual.Should().BeTrue();
actual.ShouldBe(true);
}

[Fact]
Expand All @@ -63,7 +63,7 @@ public async Task TryReceive_GivenEmptyTopic_ShouldReturnFalse()
var actual = receiver.TryReceive(out var message);

//Assert
actual.Should().BeFalse();
actual.ShouldBe(false);
}

private static string CreateSubscriptionName() => $"subscription-{Guid.NewGuid():N}";
Expand Down
20 changes: 10 additions & 10 deletions tests/DotPulsar.Tests/Extensions/StateExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task OnStateChangeTo_WhenChangingToFinalStateInitially_ShouldReturn
var actual = await uut.OnStateChangeTo(ProducerState.Disconnected, TimeSpan.FromSeconds(1));

// Assert
actual.Should().Be(expected);
actual.ShouldBe(expected);
}

[Theory, Tests.AutoData]
Expand All @@ -52,7 +52,7 @@ public async Task OnStateChangeTo_WhenChangingToFinalStateWhileWaitingForDelay_S
var actual = await uut.OnStateChangeTo(ProducerState.Disconnected, TimeSpan.FromSeconds(1));

// Assert
actual.Should().Be(expected);
actual.ShouldBe(expected);
}

[Theory, Tests.AutoData]
Expand All @@ -68,7 +68,7 @@ public async Task OnStateChangeTo_WhenTheDelayIsExceeded_ShouldReturnState([Froz
var actual = await uut.OnStateChangeTo(expected, TimeSpan.FromSeconds(1));

// Assert
actual.Should().Be(expected);
actual.ShouldBe(expected);
}

[Theory, Tests.AutoData]
Expand All @@ -83,7 +83,7 @@ public async Task OnStateChangeTo_WhenCancellationTokenIsCancelledInitially_Shou
var exception = await Record.ExceptionAsync(() => uut.OnStateChangeTo(ProducerState.Disconnected, TimeSpan.FromSeconds(1), cts.Token).AsTask());

// Assert
exception.Should().BeOfType<OperationCanceledException>();
exception.ShouldBeOfType<OperationCanceledException>();
}

[Theory, Tests.AutoData]
Expand All @@ -100,7 +100,7 @@ public async Task OnStateChangeTo_WhenCancellationTokenIsCancelledWhileWaitingFo
var exception = await Record.ExceptionAsync(() => uut.OnStateChangeTo(ProducerState.Disconnected, TimeSpan.FromSeconds(1), cts.Token).AsTask());

// Assert
exception.Should().BeOfType<OperationCanceledException>();
exception.ShouldBeOfType<OperationCanceledException>();
}

[Theory, Tests.AutoData]
Expand All @@ -115,7 +115,7 @@ public async Task OnStateChangeFrom_WhenChangingToFinalStateInitially_ShouldRetu
var actual = await uut.OnStateChangeFrom(ProducerState.Disconnected, TimeSpan.FromSeconds(1));

// Assert
actual.Should().Be(expected);
actual.ShouldBe(expected);
}

[Theory, Tests.AutoData]
Expand All @@ -132,7 +132,7 @@ public async Task OnStateChangeFrom_WhenChangingToFinalStateWhileWaitingForDelay
var actual = await uut.OnStateChangeFrom(ProducerState.Disconnected, TimeSpan.FromSeconds(1));

// Assert
actual.Should().Be(expected);
actual.ShouldBe(expected);
}

[Theory, Tests.AutoData]
Expand All @@ -148,7 +148,7 @@ public async Task OnStateChangeFrom_WhenTheDelayIsExceeded_ShouldReturnState([Fr
var actual = await uut.OnStateChangeFrom(ProducerState.Connected, TimeSpan.FromSeconds(1));

// Assert
actual.Should().Be(expected);
actual.ShouldBe(expected);
}

[Theory, Tests.AutoData]
Expand All @@ -163,7 +163,7 @@ public async Task OnStateChangeFrom_WhenCancellationTokenIsCancelledInitially_Sh
var exception = await Record.ExceptionAsync(() => uut.OnStateChangeFrom(ProducerState.Disconnected, TimeSpan.FromSeconds(1), cts.Token).AsTask());

// Assert
exception.Should().BeOfType<OperationCanceledException>();
exception.ShouldBeOfType<OperationCanceledException>();
}

[Theory, Tests.AutoData]
Expand All @@ -180,6 +180,6 @@ public async Task OnStateChangeFrom_WhenCancellationTokenIsCancelledWhileWaiting
var exception = await Record.ExceptionAsync(() => uut.OnStateChangeFrom(ProducerState.Disconnected, TimeSpan.FromSeconds(1), cts.Token).AsTask());

// Assert
exception.Should().BeOfType<OperationCanceledException>();
exception.ShouldBeOfType<OperationCanceledException>();
}
}
12 changes: 6 additions & 6 deletions tests/DotPulsar.Tests/Extensions/StateHolderExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public async Task DelayedStateMonitor_WhenChangingToFinalStateInitially_ShouldIn
await uut.DelayedStateMonitor(ProducerState.Connected, TimeSpan.FromSeconds(1), onStateLeft, onStateReached);

// Assert
stateLeft.HasValue.Should().BeTrue();
stateLeft!.Value.Should().Be(expected);
stateReached.HasValue.Should().BeFalse();
stateLeft.HasValue.ShouldBeTrue();
stateLeft!.Value.ShouldBe(expected);
stateReached.HasValue.ShouldBeFalse();
}

[Theory, Tests.AutoData]
Expand All @@ -61,8 +61,8 @@ public async Task DelayedStateMonitor_WhenChangingToFinalStateWhileWaiting_Shoul
await uut.DelayedStateMonitor(ProducerState.Connected, TimeSpan.FromSeconds(1), onStateLeft, onStateReached);

// Assert
stateLeft.HasValue.Should().BeTrue();
stateLeft!.Value.Should().Be(expected);
stateReached.HasValue.Should().BeFalse();
stateLeft.HasValue.ShouldBeTrue();
stateLeft!.Value.ShouldBe(expected);
stateReached.HasValue.ShouldBeFalse();
}
}
14 changes: 7 additions & 7 deletions tests/DotPulsar.Tests/Internal/AsyncLockTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task Lock_GivenLockIsFree_ShouldReturnCompletedTask()
var actual = sut.Lock(CancellationToken.None);

//Assert
actual.IsCompleted.Should().BeTrue();
actual.IsCompleted.ShouldBeTrue();

//Annihilate
(await actual).Dispose();
Expand All @@ -47,7 +47,7 @@ public async Task Lock_GivenLockIsTaken_ShouldReturnIncompletedTask()
var actual = sut.Lock(CancellationToken.None);

//Assert
actual.IsCompleted.Should().BeFalse();
actual.IsCompleted.ShouldBeFalse();

//Annihilate
alreadyTaken.Dispose();
Expand All @@ -65,7 +65,7 @@ public async Task Lock_GivenLockIsDisposed_ShouldThrowAsyncLockDisposedException
var exception = await Record.ExceptionAsync(() => sut.Lock(CancellationToken.None));

//Assert
exception.Should().BeOfType<AsyncLockDisposedException>();
exception.ShouldBeOfType<AsyncLockDisposedException>();
}

[Fact]
Expand All @@ -81,7 +81,7 @@ public async Task Lock_GivenLockIsDisposedWhileAwaitingLock_ShouldThrowTaskCance
var exception = await Record.ExceptionAsync(() => awaiting);

//Assert
exception.Should().BeOfType<TaskCanceledException>();
exception.ShouldBeOfType<TaskCanceledException>();

//Annihilate
await sut.DisposeAsync();
Expand All @@ -102,7 +102,7 @@ public async Task Lock_GivenLockIsTakenAndCancellationTokenIsActivated_ShouldThr
var exception = await Record.ExceptionAsync(() => awaiting);

//Assert
exception.Should().BeOfType<TaskCanceledException>();
exception.ShouldBeOfType<TaskCanceledException>();

//Annihilate
cts.Dispose();
Expand All @@ -124,7 +124,7 @@ public async Task Dispose_GivenLockIsDisposedWhileItIsTaken_ShouldNotCompleteBef
await disposeTask;

//Assert
disposeTask.IsCompleted.Should().BeTrue();
disposeTask.IsCompleted.ShouldBeTrue();

//Annihilate
await sut.DisposeAsync();
Expand All @@ -141,6 +141,6 @@ public async Task Dispose_WhenCalledMultipleTimes_ShouldBeSafeToDoSo()
var exception = await Record.ExceptionAsync(() => sut.DisposeAsync().AsTask()); // xUnit can't record ValueTask yet

//Assert
exception.Should().BeNull();
exception.ShouldBeNull();
}
}
16 changes: 8 additions & 8 deletions tests/DotPulsar.Tests/Internal/AsyncQueueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task Enqueue_GivenDequeueTaskWasWaiting_ShouldCompleteDequeueTask()
var actual = await dequeueTask;

//Assert
actual.Should().Be(expected);
actual.ShouldBe(expected);

//Annihilate
queue.Dispose();
Expand All @@ -50,7 +50,7 @@ public async Task DequeueAsync_GivenQueueWasNotEmpty_ShouldCompleteDequeueTask()
var actual = await queue.Dequeue();

//Assert
actual.Should().Be(expected);
actual.ShouldBe(expected);

//Annihilate
queue.Dispose();
Expand All @@ -72,8 +72,8 @@ public async Task DequeueAsync_GivenMultipleDequeues_ShouldCompleteInOrderedSequ
var actual2 = await dequeue2;

//Assert
actual1.Should().Be(expected1);
actual2.Should().Be(expected2);
actual1.ShouldBe(expected1);
actual2.ShouldBe(expected2);

//Annihilate
queue.Dispose();
Expand All @@ -93,8 +93,8 @@ public async Task DequeueAsync_GivenSequenceOfInput_ShouldReturnSameSequenceOfOu
var actual2 = await queue.Dequeue();

//Assert
actual1.Should().Be(expected1);
actual2.Should().Be(expected2);
actual1.ShouldBe(expected1);
actual2.ShouldBe(expected2);

//Annihilate
queue.Dispose();
Expand All @@ -117,8 +117,8 @@ public async Task DequeueAsync_GivenTokenIsCanceled_ShouldCancelTask()
var actual = await task2;

//Assert
exception.Should().BeOfType<TaskCanceledException>();
actual.Should().Be(excepted);
exception.ShouldBeOfType<TaskCanceledException>();
actual.ShouldBe(excepted);

//Annihilate
source1.Dispose();
Expand Down
Loading

0 comments on commit 0916a5d

Please sign in to comment.