Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
using EventFlow.Extensions;
using EventFlow.TestHelpers;
using EventFlow.TestHelpers.MsSql;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using Shouldly;

namespace EventFlow.EntityFramework.Tests.MsSql
{
Expand Down Expand Up @@ -80,9 +80,9 @@ await CommandBus
.ConfigureAwait(false);

// Assert
readModel.Should().NotBeNull();
readModel.Name.Should().Be("Bob");
readModel.Addresses.Should().BeNullOrEmpty();
readModel.ShouldNotBeNull();
readModel.Name.ShouldBe("Bob");
readModel.Addresses.ShouldBeEmpty();
}

[Test]
Expand Down Expand Up @@ -114,11 +114,21 @@ await CommandBus
.ConfigureAwait(false);

// Assert
readModel.Should().NotBeNull();
readModel.NumberOfAddresses.Should().Be(2);
readModel.Addresses.Should().HaveCount(2);
readModel.Addresses.Should().ContainEquivalentOf(address1);
readModel.Addresses.Should().ContainEquivalentOf(address2);
readModel.ShouldNotBeNull();
readModel.NumberOfAddresses.ShouldBe(2);
readModel.Addresses.Count.ShouldBe(2);

readModel.Addresses.ShouldContain(a =>
a.Street == address1.Street &&
a.PostalCode == address1.PostalCode &&
a.City == address1.City &&
a.Country == address1.Country);

readModel.Addresses.ShouldContain(a =>
a.Street == address2.Street &&
a.PostalCode == address2.PostalCode &&
a.City == address2.City &&
a.Country == address2.Country);
}
}
}
12 changes: 12 additions & 0 deletions Source/EventFlow.Examples.Shipping.Tests/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace EventFlow.Examples.Shipping.Tests;

public static class DateTimeExtensions
{
public static DateTime October(this int day, int year) => new(year, 10, day);
public static DateTime November(this int day, int year) => new(year, 11, day);
public static DateTime January(this int day, int year) => new(year, 1, day);

public static DateTime At(this DateTime date, int hours, int minutes) => new(date.Year, date.Month, date.Day, hours, minutes, 0);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
using EventFlow.Examples.Shipping.Domain.Model.VoyageModel.Commands;
using EventFlow.Examples.Shipping.Queries.InMemory;
using EventFlow.TestHelpers;
using FluentAssertions.Extensions;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using System.Linq;
using EventFlow.Examples.Shipping.Domain.Model.CargoModel.Entities;
using EventFlow.Examples.Shipping.Domain.Model.CargoModel.Specifications;
using EventFlow.Examples.Shipping.Domain.Model.VoyageModel;
using EventFlow.Examples.Shipping.Domain.Model.VoyageModel.Entities;
using EventFlow.TestHelpers;
using FluentAssertions;
using FluentAssertions.Extensions;
using NUnit.Framework;
using Shouldly;

namespace EventFlow.Examples.Shipping.Tests.UnitTests.Domain.Model.CargoModel.Speficications
{
Expand All @@ -50,8 +50,8 @@ public void Valid()
var why = sut.WhyIsNotSatisfiedBy(transportLegs);

// Assert
isSatisfiedBy.Should().BeTrue();
why.Should().HaveCount(0);
isSatisfiedBy.ShouldBeTrue();
why.Count().ShouldBe(0);
}

[Test]
Expand All @@ -70,8 +70,8 @@ public void UnloadIsAfterLoad()
var why = sut.WhyIsNotSatisfiedBy(transportLegs);

// Assert
isSatisfiedBy.Should().BeFalse();
why.Should().HaveCount(1);
isSatisfiedBy.ShouldBeFalse();
why.Count().ShouldBe(1);
}

[Test]
Expand All @@ -90,8 +90,8 @@ public void UnloadAndLoadLocationsAreDifferent()
var why = sut.WhyIsNotSatisfiedBy(transportLegs);

// Assert
isSatisfiedBy.Should().BeFalse();
why.Should().HaveCount(1);
isSatisfiedBy.ShouldBeFalse();
why.Count().ShouldBe(1);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
using EventFlow.Examples.Shipping.Domain.Model.VoyageModel;
using EventFlow.Examples.Shipping.ExternalServices.Routing;
using EventFlow.TestHelpers;
using FluentAssertions;
using FluentAssertions.Extensions;
using NUnit.Framework;
using Shouldly;

namespace EventFlow.Examples.Shipping.Tests.UnitTests.ExternalServices.Routing
{
Expand All @@ -51,7 +50,7 @@ public void Itinerary()

// Assert
// TODO: Assert list of legs
itineraries.Should().HaveCount(1);
itineraries.Count.ShouldBe(1);
}
}
}
1 change: 0 additions & 1 deletion Source/EventFlow.Examples.Shipping.Tests/Voyages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
using System.Collections.Generic;
using EventFlow.Examples.Shipping.Domain.Model.VoyageModel;
using EventFlow.Examples.Shipping.Domain.Model.VoyageModel.ValueObjects;
using FluentAssertions.Extensions;

namespace EventFlow.Examples.Shipping.Tests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@
using EventFlow.TestHelpers.Aggregates.Commands;
using EventFlow.TestHelpers.Aggregates.Events;
using EventFlow.TestHelpers.Aggregates.ValueObjects;
using FluentAssertions;
using FluentAssertions.Common;
using Hangfire;
using Hangfire.Common;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NUnit.Framework;
using Shouldly;

namespace EventFlow.Hangfire.Tests.Integration
{
Expand Down Expand Up @@ -113,7 +112,7 @@ public async Task AsynchronousSubscribesGetInvoked()

// Assert
var receivedPingId = await Task.Run(() => _testAsynchronousSubscriber.PingIds.Take(), cts.Token).ConfigureAwait(false);
receivedPingId.Should().IsSameOrEqualTo(pingId);
receivedPingId.ShouldBe(pingId);
}

[Test]
Expand Down Expand Up @@ -165,10 +164,10 @@ private async Task ValidateScheduleHappens(Func<IJob, IJobScheduler, Task<IJobId
async Task AssertJobIsSuccessfullyAsync(IJobId jobId)
{
var context = await _log.GetAsync(jobId.Value);
context.Should().NotBeNull();
context.Exception.Should().BeNull();
context.ShouldNotBeNull();
context.Exception.ShouldBeNull();
var displayName = context.BackgroundJob.Job.Args[0].ToString();
displayName.Should().Be("PublishCommand");
displayName.ShouldBe("PublishCommand");
}

[TearDown]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EventFlow.Configuration;
using EventFlow.Extensions;
using EventFlow.MongoDB.Extensions;
using EventFlow.MongoDB.Tests.IntegrationTests.ReadStores.Queries;
Expand All @@ -34,10 +33,10 @@
using EventFlow.TestHelpers.Aggregates.Entities;
using EventFlow.TestHelpers.Extensions;
using EventFlow.TestHelpers.Suites;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Mongo2Go;
using NUnit.Framework;
using Shouldly;

namespace EventFlow.MongoDB.Tests.IntegrationTests.ReadStores
{
Expand Down Expand Up @@ -80,7 +79,7 @@ public async Task AsQueryableShouldNotBeEmpty()

var result = await QueryProcessor.ProcessAsync(new MongoDbThingyGetWithLinqQuery()).ConfigureAwait(false);

result.ToList().Should().NotBeEmpty();
result.ToList().ShouldNotBeEmpty();
}

[TearDown]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
using System.Linq;
using EventFlow.MsSql.EventStores;
using EventFlow.TestHelpers;
using FluentAssertions;
using NUnit.Framework;
using Shouldly;

namespace EventFlow.MsSql.Tests.IntegrationTests.EventStores
{
Expand All @@ -38,9 +38,9 @@ public void GetSqlScripts()
var sqlScripts = EventFlowEventStoresMsSql.GetSqlScripts().ToDictionary(s => s.Name, s => s);

// Assert
sqlScripts.Should().HaveCount(2);
sqlScripts.Should().ContainKey("EventStores.Scripts.0001 - Create table EventFlow.sql");
sqlScripts.Should().ContainKey("EventStores.Scripts.0002 - Create eventdatamodel_list_type.sql");
sqlScripts.Count.ShouldBe(2);
sqlScripts.ShouldContainKey("EventStores.Scripts.0001 - Create table EventFlow.sql");
sqlScripts.ShouldContainKey("EventStores.Scripts.0002 - Create eventdatamodel_list_type.sql");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
using EventFlow.MsSql.Tests.Extensions;
using EventFlow.TestHelpers;
using EventFlow.TestHelpers.MsSql;
using FluentAssertions;
using NUnit.Framework;
using Shouldly;

// ReSharper disable StringLiteralTypo

Expand All @@ -56,7 +56,7 @@ public void VerifyIdentityHasThereLittleFragmentationUsingString()

// Assert
var fragmentation = GetIndexFragmentation("IndexFragmentationString");
fragmentation.Should().BeLessThan(10);
fragmentation.ShouldBeLessThan(10);
}


Expand All @@ -77,7 +77,7 @@ public void SanityIntLowFragmentationStoredInGuid()

// Assert
var fragmentation = GetIndexFragmentation("IndexFragmentationString");
fragmentation.Should().BeLessThan(10);
fragmentation.ShouldBeLessThan(10);
}

[Test]
Expand All @@ -97,7 +97,7 @@ public void SanityIntAsHexLowFragmentationStoredInGuid()

// Assert
var fragmentation = GetIndexFragmentation("IndexFragmentationString");
fragmentation.Should().BeLessThan(10);
fragmentation.ShouldBeLessThan(10);
}


Expand All @@ -109,7 +109,7 @@ public void SanityCombYieldsLowFragmentationStoredInGuid()

// Assert
var fragmentation = GetIndexFragmentation("IndexFragmentationGuid");
fragmentation.Should().BeLessThan(10);
fragmentation.ShouldBeLessThan(10);
}

[Test]
Expand All @@ -120,7 +120,7 @@ public void SanityCombYieldsHighFragmentationStoredInString()

// Assert
var fragmentation = GetIndexFragmentation("IndexFragmentationString");
fragmentation.Should().BeGreaterThan(90);
fragmentation.ShouldBeGreaterThan(90);
}

[Test]
Expand All @@ -131,7 +131,7 @@ public void SanityGuidIdentityYieldsHighFragmentationStoredInString()

// Assert
var fragmentation = GetIndexFragmentation("IndexFragmentationString");
fragmentation.Should().BeGreaterThan(30); // closer to 100 in reality
fragmentation.ShouldBeGreaterThan(30); // closer to 100 in reality
}

[Test]
Expand All @@ -142,7 +142,7 @@ public void SanityGuidIdentityYieldsHighFragmentationStoredInGuid()

// Assert
var fragmentation = GetIndexFragmentation("IndexFragmentationGuid");
fragmentation.Should().BeGreaterThan(30); // closer to 100 in reality
fragmentation.ShouldBeGreaterThan(30); // closer to 100 in reality
}

public void InsertRows<T>(Func<T> generator, int count, string table)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
using EventFlow.TestHelpers;
using EventFlow.TestHelpers.Extensions;
using EventFlow.TestHelpers.MsSql;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using Shouldly;

namespace EventFlow.MsSql.Tests.IntegrationTests.ReadStores.ReadModels
{
Expand Down Expand Up @@ -120,10 +120,10 @@ public async Task MultipleDatabases()
var fetchedMagicReadModels = _readModelDatabase.Query<MagicReadModel>(
"SELECT * FROM [ReadModel-Magic] WHERE [MagicId] = @Id",
new { Id = magicId.Value });
fetchedMagicReadModels.Should().HaveCount(1);
fetchedMagicReadModels.Count.ShouldBe(1);
var fetchedMagicReadModel = fetchedMagicReadModels.Single();
fetchedMagicReadModel.Message.Should().Be(expectedMessage);
fetchedMagicReadModel.Version.Should().Be(2);
fetchedMagicReadModel.Message.ShouldBe(expectedMessage);
fetchedMagicReadModel.Version.ShouldBe(2);
}

public class MagicId : Identity<MagicId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
using System.Linq;
using EventFlow.MsSql.SnapshotStores;
using EventFlow.TestHelpers;
using FluentAssertions;
using NUnit.Framework;
using Shouldly;

namespace EventFlow.MsSql.Tests.IntegrationTests.SnapshotStores
{
Expand All @@ -38,8 +38,8 @@ public void GetSqlScripts()
var sqlScripts = EventFlowSnapshotStoresMsSql.GetSqlScripts().ToDictionary(s => s.Name, s => s);

// Assert
sqlScripts.Should().HaveCount(1);
sqlScripts.Should().ContainKey("SnapshotStores.Scripts.0001 - Create EventFlowSnapshots.sql");
sqlScripts.Count.ShouldBe(1);
sqlScripts.ShouldContainKey("SnapshotStores.Scripts.0001 - Create EventFlowSnapshots.sql");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
using System.Linq;
using EventFlow.PostgreSql.EventStores;
using EventFlow.TestHelpers;
using FluentAssertions;
using NUnit.Framework;
using Shouldly;

namespace EventFlow.PostgreSql.Tests.IntegrationTests.EventStores
{
Expand All @@ -38,9 +38,9 @@ public void GetSqlScripts()
var sqlScripts = EventFlowEventStoresPostgreSql.GetSqlScripts().ToDictionary(s => s.Name, s => s);

// Assert
sqlScripts.Should().HaveCount(2);
sqlScripts.Should().ContainKey("EventStores.Scripts.0001 - Create table EventFlow.sql");
sqlScripts.Should().ContainKey("EventStores.Scripts.0002 - Create eventdatamodel_list_type.sql");
sqlScripts.Count.ShouldBe(2);
sqlScripts.ShouldContainKey("EventStores.Scripts.0001 - Create table EventFlow.sql");
sqlScripts.ShouldContainKey("EventStores.Scripts.0002 - Create eventdatamodel_list_type.sql");
}
}
}
Loading