Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump FluentAssertions from 4.17.0 to 6.6.0 in /TimeSliceNet #50

Merged
merged 2 commits into from
May 11, 2022
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
4 changes: 2 additions & 2 deletions TimeSliceNet/TimeSliceTests/DateTimeOffsetExtensionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void TestStrippingSubSecondsDateTimeOffsetNullable()
var actual = dto.StripSubSecond();
actual.Should().HaveValue();
actual.Value.Millisecond.Should().Be(0);
actual.Value.ToString("O").ShouldBeEquivalentTo("2020-01-01T00:00:00.0000000+00:00");
actual.Value.ToString("O").Should().BeEquivalentTo("2020-01-01T00:00:00.0000000+00:00");
}

[Test]
Expand All @@ -38,4 +38,4 @@ public void TestStrippingSubSecondsDateTimeOffsetNullableNoValue()
actual.Should().NotHaveValue();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task TestGetAll()
((response as OkObjectResult).Value as List<BackstageMeetings>).Should().HaveCount(1);
var museBackstage = ((response as OkObjectResult).Value as List<BackstageMeetings>).Single();
museBackstage.TimeSlices.Should().HaveCount(2);
museBackstage.CommonParentId.ShouldBeEquivalentTo("Muse"); // CommonParentId has to be set automatically by DefaultValueGenerator
museBackstage.CommonParentId.Should().BeEquivalentTo("Muse"); // CommonParentId has to be set automatically by DefaultValueGenerator
museBackstage.TimeSlices.Any(ts => ts.Child.Name == "Joao").Should().BeTrue();
museBackstage.TimeSlices.Any(ts => ts.Child.Name == "Patricia").Should().BeTrue();
museBackstage.IsValid().Should().BeTrue();
Expand All @@ -50,11 +50,11 @@ public void TestSameBaseTypeEntriesMustNotInterfere()
using (ContextIsInUseSemaphore)
{
var joaoBackstage = context.BackstageMeetings.Single().TimeSlices.Single(ts => ts.Child.Name == "Joao");
joaoBackstage.ChildId.ShouldBeEquivalentTo("Joao"); // ChildId has to be set automatically by DefaultValueGenerator
joaoBackstage.ParentId.ShouldBeEquivalentTo("Muse"); // ParentId has to be set automatically by DefaultValueGenerator
joaoBackstage.ChildId.Should().BeEquivalentTo("Joao"); // ChildId has to be set automatically by DefaultValueGenerator
joaoBackstage.ParentId.Should().BeEquivalentTo("Muse"); // ParentId has to be set automatically by DefaultValueGenerator
var joaoAtTheStage = context.Concerts.Single(c => c.Location == "rio" && c.CommonParent.Name == "Muse").TimeSlices.Single(ts => ts.Child.Name == "Joao");
joaoAtTheStage.Should().NotBe(joaoBackstage.Discriminator);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public async Task TestGetAll()
// ReSharper disable once SuspiciousTypeConversion.Global
museAtRockInRio.Equals("null").Should().BeFalse();
var concertDirectlyFromContext = await context.Concerts.SingleAsync(c => c.CommonParentId == "Muse");
museAtRockInRio.ShouldBeEquivalentTo(concertDirectlyFromContext);
museAtRockInRio.Should().BeEquivalentTo(concertDirectlyFromContext);
concertDirectlyFromContext.Equals(museAtRockInRio).Should().BeTrue();
concertDirectlyFromContext.GetHashCode().ShouldBeEquivalentTo(museAtRockInRio.GetHashCode());
concertDirectlyFromContext.GetHashCode().Should().Be(museAtRockInRio.GetHashCode());
museAtRockInRio.TimeSlices.Should().HaveCount(3);
museAtRockInRio.TimeSlices.Should().Contain(cv => cv.Child.Name == "Joao");
museAtRockInRio.TimeSlices.Should().Contain(cv => cv.Child.Name == "Carlos");
Expand Down Expand Up @@ -99,8 +99,8 @@ public async Task InvalidEntriesMustNotBeAdded()
{
await context.BackstageMeetings.AddAsync(invalidCollection);
Action invalidSave = () => context.SaveChanges();
invalidSave.ShouldThrow<DbUpdateException>();
invalidSave.Should().Throw<DbUpdateException>();
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void ValueGeneratorsThrowNotImplementedExceptions()
foreach (var valueGenerator in GetValueGenerators())
{
Action invalidNext = () => valueGenerator.Next(entry);
invalidNext.ShouldThrow<NotImplementedException>();
invalidNext.Should().Throw<NotImplementedException>();
}
}
finally
Expand All @@ -98,4 +98,4 @@ public void ValueGeneratorDontGenerateTemporaryValues()
}
}
}
}
}
10 changes: 5 additions & 5 deletions TimeSliceNet/TimeSliceTests/PlainTimeSliceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void TestDeserializationRoundTrip(string json)
pts.Should().NotBeNull();
pts.IsValid().Should().BeTrue();
var reserializedPts = JsonSerializer.Serialize(pts, _minifyOptions);
reserializedPts.ShouldBeEquivalentTo(json);
reserializedPts.Should().BeEquivalentTo(json);
}

/// <summary>
Expand Down Expand Up @@ -191,7 +191,7 @@ public void TestNullEndDateDeserialization(string json)
public void TestNullStartDateDeserialization(string json)
{
Action invalidDeserializationAction = () => JsonSerializer.Deserialize<PlainTimeSlice>(json);
invalidDeserializationAction.ShouldThrow<FormatException>();
invalidDeserializationAction.Should().Throw<FormatException>();
}

/// <summary>
Expand All @@ -206,7 +206,7 @@ public void TestDeserializationEnforceOffset()
{
const string json = "{\"Start\":\"2021-07-01T00:00:00\",\"End\":\"2021-08-01T00:00:00\"}";
Action invalidDeserializationAction = () => JsonSerializer.Deserialize<PlainTimeSlice>(json);
invalidDeserializationAction.ShouldThrow<FormatException>();
invalidDeserializationAction.Should().Throw<FormatException>();
}

[Test]
Expand Down Expand Up @@ -247,7 +247,7 @@ public void TestSameTimeSliceHasSameHashCode()
Start = new DateTimeOffset(2021, 7, 1, 0, 0, 0, TimeSpan.Zero),
End = null
};
ptsA.ShouldBeEquivalentTo(ptsB);
ptsA.Should().BeEquivalentTo(ptsB);
var set = new HashSet<PlainTimeSlice>
{
ptsA, // adding a equal time slice
Expand All @@ -256,4 +256,4 @@ public void TestSameTimeSliceHasSameHashCode()
set.Should().HaveCount(1); // but we'll keep only one
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public void TestIListProperties()
var collection = new RelationsWithOverlaps(sharedParent);
collection.Add(tsA);
collection.Add(tsB);
collection.TimeSlices.Count.ShouldBeEquivalentTo(collection.Count);
collection.Contains(tsA).ShouldBeEquivalentTo(collection.TimeSliceList.Contains(tsA));
collection.TimeSlices.Count.Should().Be(collection.Count);
collection.Contains(tsA).Should().Be(collection.TimeSliceList.Contains(tsA));
collection.IndexOf(tsB).Should().Be(1);
collection.Remove(tsB);
collection.Count.Should().Be(1);
Expand Down Expand Up @@ -124,7 +124,7 @@ public void TestValidationErrorsAreForwarded()
public void TestParentMustNotBeNull()
{
Action addingNullAsParent = () => _ = new RelationsWithOverlaps(null);
addingNullAsParent.ShouldThrow<ArgumentNullException>();
addingNullAsParent.Should().Throw<ArgumentNullException>();
}

/// <summary>
Expand All @@ -135,7 +135,7 @@ public void TestChildMustNotBeNull()
{
var rs = new RelationsWithOverlaps(new Foo());
Action nullAdd = () => rs.Add(null);
nullAdd.ShouldThrow<ArgumentNullException>();
nullAdd.Should().Throw<ArgumentNullException>();
}

/// <summary>
Expand All @@ -153,7 +153,7 @@ public void TestAllSlicesMustHaveSameParent()
Child = new Bar()
};
Action invalidAdd = () => collection.Add(sliceWithWrongParent);
invalidAdd.ShouldThrow<ArgumentException>();
invalidAdd.Should().Throw<ArgumentException>();
}

/// <summary>
Expand Down Expand Up @@ -196,11 +196,11 @@ public void TestCollectionDeserialization()
deserializedCollection.Should().NotBeNull();
// ReSharper disable once PossibleNullReferenceException
deserializedCollection.CollectionType.Should().Be(collection.CollectionType);
deserializedCollection.Count.ShouldBeEquivalentTo(collection.Count);
deserializedCollection.CommonParent.ShouldBeEquivalentTo(collection.CommonParent);
deserializedCollection.TimeSlices[0].ShouldBeEquivalentTo(collection.TimeSlices[0]);
deserializedCollection.TimeSlices[1].ShouldBeEquivalentTo(collection.TimeSlices[1]);
deserializedCollection.ShouldBeEquivalentTo(collection);
deserializedCollection.Count.Should().Be(collection.Count);
deserializedCollection.CommonParent.Should().BeEquivalentTo(collection.CommonParent);
deserializedCollection.TimeSlices[0].Should().BeEquivalentTo(collection.TimeSlices[0]);
deserializedCollection.TimeSlices[1].Should().BeEquivalentTo(collection.TimeSlices[1]);
deserializedCollection.Should().BeEquivalentTo(collection);
deserializedCollection.TimeSlices.GetHashCode().Should().NotBe(collection.TimeSlices.GetHashCode());
deserializedCollection.GetHashCode().Should().NotBe(collection.GetHashCode());
}
Expand Down Expand Up @@ -298,4 +298,4 @@ public override int GetHashCode()
return BarName != null ? BarName.GetHashCode() : 0;
}
}
}
}
4 changes: 2 additions & 2 deletions TimeSliceNet/TimeSliceTests/TimeDependentRelationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void TimeDependentRelationDeSerialization()
var json = JsonSerializer.Serialize(tdpcr);
var deserializedTdpcr = JsonSerializer.Deserialize<TimeDependentRelation<Foo, Bar>>(json);
deserializedTdpcr.Should().NotBeNull();
deserializedTdpcr.ShouldBeEquivalentTo(tdpcr);
deserializedTdpcr.Should().BeEquivalentTo(tdpcr);
}

[Test]
Expand Down Expand Up @@ -136,4 +136,4 @@ public void TestRelationShouldHaveHashCodeThatDependsOnProperties()
tdpcr.GetHashCode().Should().NotBe(anotherTdpcr.GetHashCode());
}
}
}
}
4 changes: 2 additions & 2 deletions TimeSliceNet/TimeSliceTests/TimeSliceExtensionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void TestOverlapsWithOtherTimeSlice(string startStringA, string endString
var ptsB = TestHelper.CreateTimeSlice(startStringB, endStringB);
var actual = ptsA.Overlaps(ptsB);
ptsB.Overlaps(ptsA).Should().Be(actual); // if A overlaps B, then B also overlaps A
actual.ShouldBeEquivalentTo(expected);
actual.Should().Be(expected);
}
}
}
}
2 changes: 1 addition & 1 deletion TimeSliceNet/TimeSliceTests/TimeSliceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="4.17.0" />
<PackageReference Include="FluentAssertions" Version="6.6.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
Expand Down