diff --git a/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil.Tests/DavidBerry.Framework.ApiUtil.Tests.csproj b/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil.Tests/DavidBerry.Framework.ApiUtil.Tests.csproj index aeb3952..08539df 100644 --- a/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil.Tests/DavidBerry.Framework.ApiUtil.Tests.csproj +++ b/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil.Tests/DavidBerry.Framework.ApiUtil.Tests.csproj @@ -7,10 +7,14 @@ - + + - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil.csproj b/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil.csproj index cd987eb..beb9acd 100644 --- a/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil.csproj +++ b/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil.csproj @@ -12,9 +12,9 @@ - + - + diff --git a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/BoundingBoxTests.cs b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/BoundingBoxTests.cs index a57ebb7..d20d37e 100644 --- a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/BoundingBoxTests.cs +++ b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/BoundingBoxTests.cs @@ -1,4 +1,4 @@ -using FluentAssertions; +using Shouldly; using System; using System.Collections.Generic; using System.Text; @@ -18,17 +18,17 @@ public void ConsturctorTakesValidPoints(double topLeftLatitude, double topLeftLo BoundingBox box = new BoundingBox(topLeftLatitude, topLeftLongitude, bottomRightLatitude, bottomRightLongitude); - box.PointOne.Latitude.Value.Should().Be(topLeftLatitude); - box.PointOne.Longitude.Value.Should().Be(topLeftLongitude); - box.PointTwo.Latitude.Value.Should().Be(bottomRightLatitude); - box.PointTwo.Longitude.Value.Should().Be(bottomRightLongitude); + box.PointOne.Latitude.Value.ShouldBe(topLeftLatitude); + box.PointOne.Longitude.Value.ShouldBe(topLeftLongitude); + box.PointTwo.Latitude.Value.ShouldBe(bottomRightLatitude); + box.PointTwo.Longitude.Value.ShouldBe(bottomRightLongitude); } [Fact] public void ConsturctorRejectsPointsThatAreTheSame() { - var exception = Assert.Throws(() => new BoundingBox(41.93301, -87.62007, 41.93301, -87.62007)); + var exception = Assert.Throws(() => new BoundingBox(41.93301, -87.62007, 41.93301, -87.62007)); } } diff --git a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/CompassDirectionTests.cs b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/CompassDirectionTests.cs index bb0e9fc..4bfdf6a 100644 --- a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/CompassDirectionTests.cs +++ b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/CompassDirectionTests.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; using Xunit; -using FluentAssertions; +using Shouldly; using System.Linq; namespace DavidBerry.Framework.Spatial.Tests @@ -33,7 +33,7 @@ public void CheckBearingsResultInCorrectCompassDirection(double bearing, string var direction = CompassDirection.GetDirection(bearing); // Assert - direction.Abbreviation.Should().Be(expectedDirection, + direction.Abbreviation.ShouldBe(expectedDirection, $"Expected direction of {expectedDirection} but got {direction.Abbreviation} for bearing {bearing}"); } @@ -53,7 +53,7 @@ public void CheckBoundaryBearingsReturCorrectDirectionForCardinalDirections(doub var direction = CompassDirection.GetDirection(bearing); // Assert - direction.Abbreviation.Should().Be(expectedDirection, + direction.Abbreviation.ShouldBe(expectedDirection, $"Expected direction of {expectedDirection} but got {direction.Abbreviation} for bearing {bearing}"); } @@ -73,7 +73,7 @@ public void CheckBoundaryBearingsReturCorrectDirectionForIntercardinalDirections var direction = CompassDirection.GetDirection(bearing); // Assert - direction.Abbreviation.Should().Be(expectedDirection, + direction.Abbreviation.ShouldBe(expectedDirection, $"Expected direction of {expectedDirection} but got {direction.Abbreviation} for bearing {bearing}"); } @@ -95,36 +95,36 @@ public void CheckEqualsReturnsFalseWhenNullPassedIn() { var result = CompassDirection.NORTH.Equals(null); - result.Should().BeFalse(); + result.ShouldBeFalse(); } [Fact] public void CheckAllDirectionsEqualThemselves() { - CompassDirection.NORTH.Equals(CompassDirection.NORTH).Should().BeTrue(); - CompassDirection.NORTH_NORTHEAST.Equals(CompassDirection.NORTH_NORTHEAST).Should().BeTrue(); - CompassDirection.NORTHEAST.Equals(CompassDirection.NORTHEAST).Should().BeTrue(); - CompassDirection.EAST_NORTHEAST.Equals(CompassDirection.EAST_NORTHEAST).Should().BeTrue(); - CompassDirection.EAST.Equals(CompassDirection.EAST).Should().BeTrue(); - CompassDirection.EAST_SOUTHEAST.Equals(CompassDirection.EAST_SOUTHEAST).Should().BeTrue(); - CompassDirection.SOUTHEAST.Equals(CompassDirection.SOUTHEAST).Should().BeTrue(); - CompassDirection.SOUTH_SOUTHEAST.Equals(CompassDirection.SOUTH_SOUTHEAST).Should().BeTrue(); - CompassDirection.SOUTH.Equals(CompassDirection.SOUTH).Should().BeTrue(); - CompassDirection.SOUTH_SOUTHWEST.Equals(CompassDirection.SOUTH_SOUTHWEST).Should().BeTrue(); - CompassDirection.SOUTHWEST.Equals(CompassDirection.SOUTHWEST).Should().BeTrue(); - CompassDirection.WEST_SOUTHWEST.Equals(CompassDirection.WEST_SOUTHWEST).Should().BeTrue(); - CompassDirection.WEST.Equals(CompassDirection.WEST).Should().BeTrue(); - CompassDirection.WEST_NORTHWEST.Equals(CompassDirection.WEST_NORTHWEST).Should().BeTrue(); - CompassDirection.NORTHWEST.Equals(CompassDirection.NORTHWEST).Should().BeTrue(); - CompassDirection.NORTH_NORTHWEST.Equals(CompassDirection.NORTH_NORTHWEST).Should().BeTrue(); + CompassDirection.NORTH.Equals(CompassDirection.NORTH).ShouldBeTrue(); + CompassDirection.NORTH_NORTHEAST.Equals(CompassDirection.NORTH_NORTHEAST).ShouldBeTrue(); + CompassDirection.NORTHEAST.Equals(CompassDirection.NORTHEAST).ShouldBeTrue(); + CompassDirection.EAST_NORTHEAST.Equals(CompassDirection.EAST_NORTHEAST).ShouldBeTrue(); + CompassDirection.EAST.Equals(CompassDirection.EAST).ShouldBeTrue(); + CompassDirection.EAST_SOUTHEAST.Equals(CompassDirection.EAST_SOUTHEAST).ShouldBeTrue(); + CompassDirection.SOUTHEAST.Equals(CompassDirection.SOUTHEAST).ShouldBeTrue(); + CompassDirection.SOUTH_SOUTHEAST.Equals(CompassDirection.SOUTH_SOUTHEAST).ShouldBeTrue(); + CompassDirection.SOUTH.Equals(CompassDirection.SOUTH).ShouldBeTrue(); + CompassDirection.SOUTH_SOUTHWEST.Equals(CompassDirection.SOUTH_SOUTHWEST).ShouldBeTrue(); + CompassDirection.SOUTHWEST.Equals(CompassDirection.SOUTHWEST).ShouldBeTrue(); + CompassDirection.WEST_SOUTHWEST.Equals(CompassDirection.WEST_SOUTHWEST).ShouldBeTrue(); + CompassDirection.WEST.Equals(CompassDirection.WEST).ShouldBeTrue(); + CompassDirection.WEST_NORTHWEST.Equals(CompassDirection.WEST_NORTHWEST).ShouldBeTrue(); + CompassDirection.NORTHWEST.Equals(CompassDirection.NORTHWEST).ShouldBeTrue(); + CompassDirection.NORTH_NORTHWEST.Equals(CompassDirection.NORTH_NORTHWEST).ShouldBeTrue(); } [Fact] public void CheckDirectionsThatDoNotEqualReturnFalse() { - CompassDirection.NORTH.Equals(CompassDirection.EAST).Should().BeFalse(); + CompassDirection.NORTH.Equals(CompassDirection.EAST).ShouldBeFalse(); } [Fact] @@ -135,7 +135,7 @@ public void CheckAllDirectionsHaveUniqueAbbreviations() .Distinct() .Count(); - uniquePoints.Should().Be(CompassDirection.COMPASS_POINTS.Length); + uniquePoints.ShouldBe(CompassDirection.COMPASS_POINTS.Length); } @@ -147,7 +147,7 @@ public void CheckHashcodesDifferentForDifferentCompassPoints() .Distinct() .Count(); - uniqueHashCodes.Should().Be(CompassDirection.COMPASS_POINTS.Length); + uniqueHashCodes.ShouldBe(CompassDirection.COMPASS_POINTS.Length); } diff --git a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/DavidBerry.Framework.Spatial.Tests.csproj b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/DavidBerry.Framework.Spatial.Tests.csproj index 2d636c0..2446e49 100644 --- a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/DavidBerry.Framework.Spatial.Tests.csproj +++ b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/DavidBerry.Framework.Spatial.Tests.csproj @@ -57,12 +57,12 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/GeoCoordinateTests.cs b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/GeoCoordinateTests.cs index edeb10b..d41d84a 100644 --- a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/GeoCoordinateTests.cs +++ b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/GeoCoordinateTests.cs @@ -1,6 +1,6 @@ using System; using Xunit; -using FluentAssertions; +using Shouldly; using UnitsNet.Units; using DavidBerry.Framework.Spatial; @@ -22,13 +22,13 @@ public void CanConstructValidPointWithDegrees(double latitude, double longitude) { GeoCoordinate p = new GeoCoordinate(latitude, longitude); - p.Should().NotBeNull(); + p.ShouldNotBeNull(); - p.Latitude.Unit.Should().Be(AngleUnit.Degree); - p.Latitude.Value.Should().Be(latitude); + p.Latitude.Unit.ShouldBe(AngleUnit.Degree); + p.Latitude.Value.ShouldBe(latitude); - p.Longitude.Unit.Should().Be(AngleUnit.Degree); - p.Longitude.Value.Should().Be(longitude); + p.Longitude.Unit.ShouldBe(AngleUnit.Degree); + p.Longitude.Value.ShouldBe(longitude); } diff --git a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/Geocoding/Google/GoogleGeocoderTests.cs b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/Geocoding/Google/GoogleGeocoderTests.cs index cc3aa29..12675b5 100644 --- a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/Geocoding/Google/GoogleGeocoderTests.cs +++ b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/Geocoding/Google/GoogleGeocoderTests.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; using Xunit; -using FluentAssertions; +using Shouldly; using DavidBerry.Framework.Util; using DavidBerry.Framework.Spatial.Geocoding; using DavidBerry.Framework.Spatial.Geocoding.Google; @@ -12,6 +12,7 @@ using RestSharp; using Moq; using System.Threading; +using Shouldly.ShouldlyExtensionMethods; namespace DavidBerry.Framework.Spatial.Tests.Geocoding.Google { @@ -25,39 +26,39 @@ public void GoogleResponseObjectMapsvaluesCorrectlyUsingJsonAttributes() var googleResponse = JsonConvert.DeserializeObject(json); - googleResponse.Status.Should().Be("OK"); - googleResponse.ErrorMessage.Should().BeNull(); - googleResponse.Results.Should().HaveCount(1); + googleResponse.Status.ShouldBe("OK"); + googleResponse.ErrorMessage.ShouldBeNull(); + googleResponse.Results.Count().ShouldBe(1); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("street_number")).ShortValue.Should().Be("1600"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("street_number")).LongValue.Should().Be("1600"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("street_number")).ShortValue.ShouldBe("1600"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("street_number")).LongValue.ShouldBe("1600"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("route")).ShortValue.Should().Be("Amphitheatre Pkwy"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("route")).LongValue.Should().Be("Amphitheatre Pkwy"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("route")).ShortValue.ShouldBe("Amphitheatre Pkwy"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("route")).LongValue.ShouldBe("Amphitheatre Pkwy"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("locality")).ShortValue.Should().Be("Mountain View"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("locality")).LongValue.Should().Be("Mountain View"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("locality")).ShortValue.ShouldBe("Mountain View"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("locality")).LongValue.ShouldBe("Mountain View"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("administrative_area_level_1")).ShortValue.Should().Be("CA"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("administrative_area_level_1")).LongValue.Should().Be("California"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("administrative_area_level_1")).ShortValue.ShouldBe("CA"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("administrative_area_level_1")).LongValue.ShouldBe("California"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("country")).ShortValue.Should().Be("US"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("country")).LongValue.Should().Be("United States"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("country")).ShortValue.ShouldBe("US"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("country")).LongValue.ShouldBe("United States"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("postal_code")).ShortValue.Should().Be("94043"); - googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("postal_code")).LongValue.Should().Be("94043"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("postal_code")).ShortValue.ShouldBe("94043"); + googleResponse.Results[0].AddressComponents.First(c => c.ValueTypes.Contains("postal_code")).LongValue.ShouldBe("94043"); - googleResponse.Results[0].FormattedAddress.Should().Be("1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"); + googleResponse.Results[0].FormattedAddress.ShouldBe("1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"); - googleResponse.Results[0].Geometry.Location.Latitude.Should().Be(37.4224764); - googleResponse.Results[0].Geometry.Location.Longitude.Should().Be(-122.0842499); - googleResponse.Results[0].Geometry.LocationType.Should().Be("ROOFTOP"); - googleResponse.Results[0].Geometry.Viewport.NortheastPoint.Latitude.Should().Be(37.4238253802915); - googleResponse.Results[0].Geometry.Viewport.NortheastPoint.Longitude.Should().Be(-122.0829009197085); - googleResponse.Results[0].Geometry.Viewport.SouthwestPoint.Latitude.Should().Be(37.4211274197085); - googleResponse.Results[0].Geometry.Viewport.SouthwestPoint.Longitude.Should().Be(-122.0855988802915); + googleResponse.Results[0].Geometry.Location.Latitude.ShouldBe(37.4224764); + googleResponse.Results[0].Geometry.Location.Longitude.ShouldBe(-122.0842499); + googleResponse.Results[0].Geometry.LocationType.ShouldBe("ROOFTOP"); + googleResponse.Results[0].Geometry.Viewport.NortheastPoint.Latitude.ShouldBe(37.4238253802915); + googleResponse.Results[0].Geometry.Viewport.NortheastPoint.Longitude.ShouldBe(-122.0829009197085); + googleResponse.Results[0].Geometry.Viewport.SouthwestPoint.Latitude.ShouldBe(37.4211274197085); + googleResponse.Results[0].Geometry.Viewport.SouthwestPoint.Longitude.ShouldBe(-122.0855988802915); - googleResponse.Results[0].GoogleMapsPlaceId.Should().Be("ChIJ2eUgeAK6j4ARbn5u_wAGqWA"); + googleResponse.Results[0].GoogleMapsPlaceId.ShouldBe("ChIJ2eUgeAK6j4ARbn5u_wAGqWA"); } @@ -81,7 +82,7 @@ public void VerifyFormattedLocationStringIsMappedToGeocodingResponseObject() GoogleGeocodingService service = new GoogleGeocodingService("test", mockRestClient.Object); var result = service.GeocodeAddress(It.IsAny()); - result.Value[0].FormattedAddress.Should().Be("1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"); + result.Value[0].FormattedAddress.ShouldBe("1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"); } [Fact] @@ -104,8 +105,8 @@ public void VerifyLocationLatitudeLongitudeMappedCorrectlyInReturnObject() GoogleGeocodingService service = new GoogleGeocodingService("test", mockRestClient.Object); var result = service.GeocodeAddress(It.IsAny()); - result.Value[0].Location.Latitude.Value.Should().BeApproximately(37.422476, 0.00001); - result.Value[0].Location.Longitude.Value.Should().BeApproximately(-122.0842499, 0.00001); + result.Value[0].Location.Latitude.Value.ShouldBe(37.422476, 0.00001); + result.Value[0].Location.Longitude.Value.ShouldBe(-122.0842499, 0.00001); } @@ -131,13 +132,13 @@ public void VerifyFullCallResponseWhenGoogleReturnsSingleAddress() GoogleGeocodingService service = new GoogleGeocodingService("test", mockRestClient.Object); var result = service.GeocodeAddress(It.IsAny()); - result.IsSuccess.Should().BeTrue(); - result.Value.Should().NotBeNull(); - result.Value.Count.Should().Be(1); + result.IsSuccess.ShouldBeTrue(); + result.Value.ShouldNotBeNull(); + result.Value.Count.ShouldBe(1); - result.Value[0].FormattedAddress.Should().Be("1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"); - result.Value[0].Location.Latitude.Value.Should().BeApproximately(37.422476, 0.00001); - result.Value[0].Location.Longitude.Value.Should().BeApproximately(-122.0842499, 0.00001); + result.Value[0].FormattedAddress.ShouldBe("1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"); + result.Value[0].Location.Latitude.Value.ShouldBe(37.422476, 0.00001); + result.Value[0].Location.Longitude.Value.ShouldBe(-122.0842499, 0.00001); } @@ -161,9 +162,9 @@ public void VerifyFailureResultReturnedWhenGoogleReturnsError() GoogleGeocodingService service = new GoogleGeocodingService("test", mockRestClient.Object); var result = service.GeocodeAddress(It.IsAny()); - result.IsSuccess.Should().BeFalse(); - result.Error.Message.Should().Be("Call to Google geocoding service failed"); - result.Value.Should().BeNull(); + result.IsSuccess.ShouldBeFalse(); + result.Error.Message.ShouldBe("Call to Google geocoding service failed"); + result.Value.ShouldBeNull(); } @@ -187,21 +188,21 @@ public void VerifySingleCitySearchDecodesCorrectly() GoogleGeocodingService service = new GoogleGeocodingService("test", mockRestClient.Object); var result = service.GeocodeAddress(It.IsAny()); - result.IsSuccess.Should().BeTrue(); - result.Value.Should().NotBeNull(); - result.Value.Count.Should().Be(1); + result.IsSuccess.ShouldBeTrue(); + result.Value.ShouldNotBeNull(); + result.Value.Count.ShouldBe(1); - result.Value[0].FormattedAddress.Should().Be("Boise, ID, USA"); - result.Value[0].Location.Latitude.Value.Should().BeApproximately(43.6150186, 0.00001); - result.Value[0].Location.Longitude.Value.Should().BeApproximately(-116.2023137, 0.00001); + result.Value[0].FormattedAddress.ShouldBe("Boise, ID, USA"); + result.Value[0].Location.Latitude.Value.ShouldBe(43.6150186, 0.00001); + result.Value[0].Location.Longitude.Value.ShouldBe(-116.2023137, 0.00001); - result.Value[0].LocationType.Should().Be(LocationType.CITY); + result.Value[0].LocationType.ShouldBe(LocationType.CITY); - result.Value[0].Viewport.PointOne.Latitude.Value.Should().BeApproximately(43.6898951, 0.00001); - result.Value[0].Viewport.PointOne.Longitude.Value.Should().BeApproximately(-116.1019091, 0.00001); + result.Value[0].Viewport.PointOne.Latitude.Value.ShouldBe(43.6898951, 0.00001); + result.Value[0].Viewport.PointOne.Longitude.Value.ShouldBe(-116.1019091, 0.00001); - result.Value[0].Viewport.PointTwo.Latitude.Value.Should().BeApproximately(43.511717, 0.00001); - result.Value[0].Viewport.PointTwo.Longitude.Value.Should().BeApproximately(-116.3658869, 0.00001); + result.Value[0].Viewport.PointTwo.Latitude.Value.ShouldBe(43.511717, 0.00001); + result.Value[0].Viewport.PointTwo.Longitude.Value.ShouldBe(-116.3658869, 0.00001); } @@ -225,27 +226,27 @@ public void VerifyCitySearchWithMultipleResultsDecodesCorrectly() GoogleGeocodingService service = new GoogleGeocodingService("test", mockRestClient.Object); var result = service.GeocodeAddress(It.IsAny()); - result.IsSuccess.Should().BeTrue(); - result.Value.Should().NotBeNull(); - result.Value.Count.Should().Be(3); + result.IsSuccess.ShouldBeTrue(); + result.Value.ShouldNotBeNull(); + result.Value.Count.ShouldBe(3); // Springfield, MO - result.Value[0].FormattedAddress.Should().Be("Springfield, MO, USA"); - result.Value[0].Location.Latitude.Value.Should().BeApproximately(37.2089572, 0.00001); - result.Value[0].Location.Longitude.Value.Should().BeApproximately(-93.29229889999999, 0.00001); - result.Value[0].LocationType.Should().HaveFlag(LocationType.CITY); + result.Value[0].FormattedAddress.ShouldBe("Springfield, MO, USA"); + result.Value[0].Location.Latitude.Value.ShouldBe(37.2089572, 0.00001); + result.Value[0].Location.Longitude.Value.ShouldBe(-93.29229889999999, 0.00001); + result.Value[0].LocationType.ShouldHaveFlag(LocationType.CITY); // Springfield, IL - result.Value[1].FormattedAddress.Should().Be("Springfield, IL, USA"); - result.Value[1].Location.Latitude.Value.Should().BeApproximately(39.781721300, 0.00001); - result.Value[1].Location.Longitude.Value.Should().BeApproximately(-89.6501481, 0.00001); - result.Value[1].LocationType.Should().HaveFlag(LocationType.CITY); + result.Value[1].FormattedAddress.ShouldBe("Springfield, IL, USA"); + result.Value[1].Location.Latitude.Value.ShouldBe(39.781721300, 0.00001); + result.Value[1].Location.Longitude.Value.ShouldBe(-89.6501481, 0.00001); + result.Value[1].LocationType.ShouldHaveFlag(LocationType.CITY); // Springfield, OH - result.Value[2].FormattedAddress.Should().Be("Springfield, OH, USA"); - result.Value[2].Location.Latitude.Value.Should().BeApproximately(39.9242266, 0.00001); - result.Value[2].Location.Longitude.Value.Should().BeApproximately(-83.80881711, 0.00001); - result.Value[2].LocationType.Should().HaveFlag(LocationType.CITY); + result.Value[2].FormattedAddress.ShouldBe("Springfield, OH, USA"); + result.Value[2].Location.Latitude.Value.ShouldBe(39.9242266, 0.00001); + result.Value[2].Location.Longitude.Value.ShouldBe(-83.80881711, 0.00001); + result.Value[2].LocationType.ShouldHaveFlag(LocationType.CITY); } @@ -270,21 +271,21 @@ public void VerifyUsZipCodeSearchDecodesCorrectly() GoogleGeocodingService service = new GoogleGeocodingService("test", mockRestClient.Object); var result = service.GeocodeAddress(It.IsAny()); - result.IsSuccess.Should().BeTrue(); - result.Value.Should().NotBeNull(); - result.Value.Count.Should().Be(1); + result.IsSuccess.ShouldBeTrue(); + result.Value.ShouldNotBeNull(); + result.Value.Count.ShouldBe(1); - result.Value[0].FormattedAddress.Should().Be("Boise, ID 83702, USA"); - result.Value[0].Location.Latitude.Value.Should().BeApproximately(43.6624385, 0.00001); - result.Value[0].Location.Longitude.Value.Should().BeApproximately(-116.1630431, 0.00001); + result.Value[0].FormattedAddress.ShouldBe("Boise, ID 83702, USA"); + result.Value[0].Location.Latitude.Value.ShouldBe(43.6624385, 0.00001); + result.Value[0].Location.Longitude.Value.ShouldBe(-116.1630431, 0.00001); - result.Value[0].LocationType.Should().Be(LocationType.POSTAL_CODE); + result.Value[0].LocationType.ShouldBe(LocationType.POSTAL_CODE); - result.Value[0].Viewport.PointOne.Latitude.Value.Should().BeApproximately(43.7000229, 0.00001); - result.Value[0].Viewport.PointOne.Longitude.Value.Should().BeApproximately(-116.0941219, 0.00001); + result.Value[0].Viewport.PointOne.Latitude.Value.ShouldBe(43.7000229, 0.00001); + result.Value[0].Viewport.PointOne.Longitude.Value.ShouldBe(-116.0941219, 0.00001); - result.Value[0].Viewport.PointTwo.Latitude.Value.Should().BeApproximately(43.6033878, 0.00001); - result.Value[0].Viewport.PointTwo.Longitude.Value.Should().BeApproximately(-116.2351669, 0.00001); + result.Value[0].Viewport.PointTwo.Latitude.Value.ShouldBe(43.6033878, 0.00001); + result.Value[0].Viewport.PointTwo.Longitude.Value.ShouldBe(-116.2351669, 0.00001); } @@ -309,13 +310,13 @@ public void VerifyCorrectLocationTypesAttachedToGasStationResult() var result = service.GeocodeAddress(It.IsAny()); // Assert - result.Value.Count.Should().Be(1); + result.Value.Count.ShouldBe(1); // This is a convenience store, so all three of these should light up - result.Value[0].LocationType.Should().HaveFlag(LocationType.BUSINESS); - result.Value[0].LocationType.Should().HaveFlag(LocationType.GAS_STATION); - result.Value[0].LocationType.Should().HaveFlag(LocationType.STORE); - result.Value[0].LocationType.Should().NotHaveFlag(LocationType.POINT_OF_INTEREST); // POI is assinged ot everything in Google, so it should screen out + result.Value[0].LocationType.ShouldHaveFlag(LocationType.BUSINESS); + result.Value[0].LocationType.ShouldHaveFlag(LocationType.GAS_STATION); + result.Value[0].LocationType.ShouldHaveFlag(LocationType.STORE); + result.Value[0].LocationType.ShouldNotHaveFlag(LocationType.POINT_OF_INTEREST); // POI is assinged to everything in Google, so it should be screened out } @@ -341,11 +342,11 @@ public void VerifyCorrectLocationTypesAttachedToMuseumResult() var result = service.GeocodeAddress(It.IsAny()); // Assert - result.Value.Count.Should().Be(1); + result.Value.Count.ShouldBe(1); - result.Value[0].LocationType.Should().HaveFlag(LocationType.BUSINESS); - result.Value[0].LocationType.Should().HaveFlag(LocationType.MUSEUM); - result.Value[0].LocationType.Should().HaveFlag(LocationType.POINT_OF_INTEREST); // Based on the Tourist Attraction flag in Google + result.Value[0].LocationType.ShouldHaveFlag(LocationType.BUSINESS); + result.Value[0].LocationType.ShouldHaveFlag(LocationType.MUSEUM); + result.Value[0].LocationType.ShouldHaveFlag(LocationType.POINT_OF_INTEREST); // Based on the Tourist Attraction flag in Google } [Fact] @@ -369,8 +370,8 @@ public void VerifyCorrectAirportLocationTypeAttachedToAirport() var result = service.GeocodeAddress(It.IsAny()); // Assert - result.Value.Count.Should().Be(1); - result.Value[0].LocationType.Should().HaveFlag(LocationType.AIRPORT); + result.Value.Count.ShouldBe(1); + result.Value[0].LocationType.ShouldHaveFlag(LocationType.AIRPORT); } diff --git a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/IBoundingBoxExtensionTests.cs b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/IBoundingBoxExtensionTests.cs index 1184ca1..7f7633e 100644 --- a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/IBoundingBoxExtensionTests.cs +++ b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/IBoundingBoxExtensionTests.cs @@ -1,4 +1,4 @@ -using FluentAssertions; +using Shouldly; using System; using System.Collections.Generic; using System.Text; @@ -17,15 +17,15 @@ public class IBoundingBoxExtensionTests [InlineData(13.7994072, 145.112915, 13.1022175, 144.4647218, 13.7994072, 145.112915)] [InlineData(-31.6244855, 116.239023, -32.4556424, 115.6840483, -31.6244855, 116.239023)] [InlineData(-30.0852149, -53.0779284, -35.1558001, -58.4913609, -30.0852149, -53.0779284)] - public void ValidateNortheastExtensionMethod(double pointOneLatitude, double pointOneLongitude, + public void ValidateNortheastExtensionMethod(double pointOneLatitude, double pointOneLongitude, double pointTwoLatitude, double pointTwoLongitude, double expectedLatitude, double expectedLongitude) { BoundingBox box = new BoundingBox(pointOneLatitude, pointOneLongitude, pointTwoLatitude, pointTwoLongitude); var northeastPoint = box.Northeast(); - northeastPoint.Latitude.Value.Should().BeApproximately(expectedLatitude, 0.0001); - northeastPoint.Longitude.Value.Should().BeApproximately(expectedLongitude, 0.0001); + northeastPoint.Latitude.Value.ShouldBe(expectedLatitude, 0.0001); + northeastPoint.Longitude.Value.ShouldBe(expectedLongitude, 0.0001); } @@ -42,8 +42,8 @@ public void ValidateNorthwestExtensionMethod(double pointOneLatitude, double poi var northwestPoint = box.Northwest(); - northwestPoint.Latitude.Value.Should().BeApproximately(expectedLatitude, 0.0001); - northwestPoint.Longitude.Value.Should().BeApproximately(expectedLongitude, 0.0001); + northwestPoint.Latitude.Value.ShouldBe(expectedLatitude, 0.0001); + northwestPoint.Longitude.Value.ShouldBe(expectedLongitude, 0.0001); } @@ -60,8 +60,8 @@ public void ValidateSouthwestExtensionMethod(double pointOneLatitude, double poi var southwestPoint = box.Southwest(); - southwestPoint.Latitude.Value.Should().BeApproximately(expectedLatitude, 0.0001); - southwestPoint.Longitude.Value.Should().BeApproximately(expectedLongitude, 0.0001); + southwestPoint.Latitude.Value.ShouldBe(expectedLatitude, 0.0001); + southwestPoint.Longitude.Value.ShouldBe(expectedLongitude, 0.0001); } @@ -79,8 +79,8 @@ public void ValidateSoutheastExtensionMethod(double pointOneLatitude, double poi var southeastPoint = box.Southeast(); - southeastPoint.Latitude.Value.Should().BeApproximately(expectedLatitude, 0.0001); - southeastPoint.Longitude.Value.Should().BeApproximately(expectedLongitude, 0.0001); + southeastPoint.Latitude.Value.ShouldBe(expectedLatitude, 0.0001); + southeastPoint.Longitude.Value.ShouldBe(expectedLongitude, 0.0001); } @@ -97,7 +97,7 @@ public void ContainsKeyReturnsTrueForPointInBoundingBox(double pointOneLatitude, var contains = box.ContainsPoint(testPointLatitude, testPointLongitude); - contains.Should().BeTrue(); + contains.ShouldBeTrue(); } @@ -111,7 +111,7 @@ public void ContainsKeyReturnsFalseForPointOutsideBoundingBox(double pointOneLat var contains = box.ContainsPoint(testPointLatitude, testPointLongitude); - contains.Should().BeFalse(); + contains.ShouldBeFalse(); } } diff --git a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/IGeoCoordinateExtensionsTests.cs b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/IGeoCoordinateExtensionsTests.cs index 1bcb284..a104b19 100644 --- a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/IGeoCoordinateExtensionsTests.cs +++ b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/IGeoCoordinateExtensionsTests.cs @@ -3,7 +3,7 @@ using System.Text; using UnitsNet; using Xunit; -using FluentAssertions; +using Shouldly; using UnitsNet.Units; using DavidBerry.Framework.Spatial; @@ -25,13 +25,13 @@ public void CheckDistanceCalculationCorrect(double originLatitude, double origin var distanceInMeters = origin.HaversineDistance(destination); // Assert - distanceInMeters.Value.Should().BeApproximately(expectedDistance, 0.005); + distanceInMeters.Value.ShouldBe(expectedDistance, 0.005); } [Fact] public void CheckDefaultDistanceUnitsIsMeters() - { + { // Arrange GeoCoordinate origin = new GeoCoordinate(41.866738, -87.616977); GeoCoordinate destination = new GeoCoordinate(40.689311, -74.044503); @@ -39,7 +39,7 @@ public void CheckDefaultDistanceUnitsIsMeters() // Act var distance = origin.HaversineDistance(destination); - distance.Unit.Should().Be(LengthUnit.Meter); + distance.Unit.ShouldBe(LengthUnit.Meter); } @@ -54,8 +54,8 @@ public void CheckDistanceUnitsPassedInIsUsedInResult() var distance = origin.HaversineDistance(destination, LengthUnit.Mile); // Assert - distance.Unit.Should().Be(LengthUnit.Mile); - distance.Value.Should().BeApproximately(689.36, 0.01); + distance.Unit.ShouldBe(LengthUnit.Mile); + distance.Value.ShouldBe(689.36, 0.01); } @@ -71,8 +71,8 @@ public void CheckInitialBearingCalculations(double originLatitude, double origin var bearing = origin.InitialBearing(destination); - bearing.Unit.Should().Be(AngleUnit.Degree); - bearing.Value.Should().BeApproximately(expectedBearing, 0.005); + bearing.Unit.ShouldBe(AngleUnit.Degree); + bearing.Value.ShouldBe(expectedBearing, 0.005); } } diff --git a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.csproj b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.csproj index 23dd76f..c0a3150 100644 --- a/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.csproj +++ b/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.csproj @@ -1,13 +1,13 @@ - + net8.0 - + - + diff --git a/DavidBerry.Framework/DavidBerry.Framework.Tests/Data/EfExtensionsTest.cs b/DavidBerry.Framework/DavidBerry.Framework.Tests/Data/EfExtensionsTest.cs index 47186e0..f2af526 100644 --- a/DavidBerry.Framework/DavidBerry.Framework.Tests/Data/EfExtensionsTest.cs +++ b/DavidBerry.Framework/DavidBerry.Framework.Tests/Data/EfExtensionsTest.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using System.Text; using Xunit; -using FluentAssertions; using DavidBerry.Framework; using DavidBerry.Framework.Data; using DavidBerry.Framework.Domain; using Microsoft.EntityFrameworkCore; +using Shouldly; namespace DavidBerry.Framework.Tests.Data { @@ -18,7 +18,7 @@ public void ObjectStateNew_ConvertedToEfStateAdded() { var efSate = EfExtensions.ConvertToEFState(ObjectState.NEW); - efSate.Should().Be(EntityState.Added); + efSate.ShouldBe(EntityState.Added); } [Fact] @@ -26,7 +26,7 @@ public void ObjectStateModified_ConvertedToEfStateModified() { var efSate = EfExtensions.ConvertToEFState(ObjectState.MODIFIED); - efSate.Should().Be(EntityState.Modified); + efSate.ShouldBe(EntityState.Modified); } @@ -35,7 +35,7 @@ public void ObjectStateDeleted_ConvertedToEfStateDelated() { var efSate = EfExtensions.ConvertToEFState(ObjectState.DELETED); - efSate.Should().Be(EntityState.Deleted); + efSate.ShouldBe(EntityState.Deleted); } @@ -44,7 +44,7 @@ public void ObjectStateUnchangedd_ConvertedToEfStateUnchanged() { var efSate = EfExtensions.ConvertToEFState(ObjectState.UNCHANGED); - efSate.Should().Be(EntityState.Unchanged); + efSate.ShouldBe(EntityState.Unchanged); } } diff --git a/DavidBerry.Framework/DavidBerry.Framework.Tests/DavidBerry.Framework.Tests.csproj b/DavidBerry.Framework/DavidBerry.Framework.Tests/DavidBerry.Framework.Tests.csproj index a987095..cf1b196 100644 --- a/DavidBerry.Framework/DavidBerry.Framework.Tests/DavidBerry.Framework.Tests.csproj +++ b/DavidBerry.Framework/DavidBerry.Framework.Tests/DavidBerry.Framework.Tests.csproj @@ -21,13 +21,12 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/DavidBerry.Framework/DavidBerry.Framework.Tests/Domain/BaseEntityTests.cs b/DavidBerry.Framework/DavidBerry.Framework.Tests/Domain/BaseEntityTests.cs index 70bea0e..7b198ba 100644 --- a/DavidBerry.Framework/DavidBerry.Framework.Tests/Domain/BaseEntityTests.cs +++ b/DavidBerry.Framework/DavidBerry.Framework.Tests/Domain/BaseEntityTests.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; using Xunit; -using FluentAssertions; +using Shouldly; using DavidBerry.Framework.Domain; namespace DavidBerry.Framework.Tests.Domain @@ -20,7 +20,7 @@ public void TestSetObjectModifiedLeavesNewObjectInNewState() entity.SetObjectModified(); // Assert - entity.ObjectState.Should().Be(ObjectState.NEW); + entity.ObjectState.ShouldBe(ObjectState.NEW); } [Fact] @@ -33,7 +33,7 @@ public void TestSetObjectModifiedChangesStateForUnchangedObject() entity.SetObjectModified(); // Assert - entity.ObjectState.Should().Be(ObjectState.MODIFIED); + entity.ObjectState.ShouldBe(ObjectState.MODIFIED); } [Fact] @@ -46,7 +46,7 @@ public void SetObjectDeleted_SetsObjectStateToDeleted() entity.SetObjectDeleted(); // Assert - entity.ObjectState.Should().Be(ObjectState.DELETED); + entity.ObjectState.ShouldBe(ObjectState.DELETED); } diff --git a/DavidBerry.Framework/DavidBerry.Framework.Tests/Functional/ResultTests.cs b/DavidBerry.Framework/DavidBerry.Framework.Tests/Functional/ResultTests.cs index f352986..3c5757b 100644 --- a/DavidBerry.Framework/DavidBerry.Framework.Tests/Functional/ResultTests.cs +++ b/DavidBerry.Framework/DavidBerry.Framework.Tests/Functional/ResultTests.cs @@ -1,5 +1,5 @@ using DavidBerry.Framework.Functional; -using FluentAssertions; +using Shouldly; using System; using System.Collections.Generic; using System.Text; @@ -14,8 +14,8 @@ public void ResultSuccess_IsSuccessTrue_WithNoErrorObjectAsError() { Result result = Result.Success(); - result.IsSuccess.Should().BeTrue(); - result.Error.Should().BeOfType(); + result.IsSuccess.ShouldBeTrue(); + result.Error.ShouldBeOfType(); } [Fact] @@ -23,7 +23,7 @@ public void ResultFailure_IsSuccessReturnsFalse() { Result result = Result.Failure("Things went terribly wrong"); - result.IsSuccess.Should().BeFalse(); + result.IsSuccess.ShouldBeFalse(); } [Fact] @@ -32,8 +32,8 @@ public void ResultFailureWithMessage_ReturnsErrorObject() string errorMessage = "Things went terribly wrong"; Result result = Result.Failure(errorMessage); - result.Error.Should().BeOfType(); - result.Error.Message.Should().Be(errorMessage); + result.Error.ShouldBeOfType(); + result.Error.Message.ShouldBe(errorMessage); } @@ -43,8 +43,8 @@ public void WhenResultFailureCalledWithErrorObject_ErrorObjectIsReturned() string errorMessage = "That data was not valid"; Result result = Result.Failure(new InvalidDataError(errorMessage)); - result.Error.Should().BeOfType(); - result.Error.Message.Should().Be(errorMessage); + result.Error.ShouldBeOfType(); + result.Error.Message.ShouldBe(errorMessage); } @@ -55,9 +55,9 @@ public void GenericResultSuccess_UsingPrimitive_IsSuccessTrue_WithNoErrorObjectA var returnValue = 32; var result = Result.Success(returnValue); - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(32); - result.Error.Should().BeOfType(); + result.IsSuccess.ShouldBeTrue(); + result.Value.ShouldBe(32); + result.Error.ShouldBeOfType(); } @@ -67,9 +67,9 @@ public void GenericResultSuccess_IsSuccessTrue_WithNoErrorObjectAsError() var result = Result.Success(new SampleEmployee("John", "Smith", "Developer")); - result.IsSuccess.Should().BeTrue(); - result.Value.Should().BeOfType(); - result.Error.Should().BeOfType(); + result.IsSuccess.ShouldBeTrue(); + result.Value.ShouldBeOfType(); + result.Error.ShouldBeOfType(); } @@ -80,7 +80,7 @@ public void When_ResultFailureOfTCalled_IsSuccess_IsFalse() var errorMessage = "Something went wrong"; var result = Result.Failure(errorMessage); - result.IsSuccess.Should().BeFalse(); + result.IsSuccess.ShouldBeFalse(); } @@ -90,7 +90,7 @@ public void When_ResultFailureOfTCalled_Value_IsDefaultValue() var errorMessage = "Something went wrong"; var result = Result.Failure(errorMessage); - result.Value.Should().Be(default); + result.Value.ShouldBe(default); } @@ -100,8 +100,8 @@ public void When_ResultFailureOfTCalledWithMessage_ErrorCreatedWithMessage() var errorMessage = "Something went wrong"; var result = Result.Failure(errorMessage); - result.Error.Message.Should().Be(errorMessage); - result.Error.Message.Should().NotBeOfType(); + result.Error.Message.ShouldBe(errorMessage); + result.Error.Message.ShouldNotBeOfType(); } @@ -111,8 +111,8 @@ public void When_ResultFailureOfTCalledWithCustomError_CustomErrorClassReturned( var errorMessage = "I could not find that employee"; var result = Result.Failure(new ObjectNotFoundError(errorMessage)); - result.Error.Should().BeOfType(); - result.Error.Message.Should().Be(errorMessage); + result.Error.ShouldBeOfType(); + result.Error.Message.ShouldBe(errorMessage); } diff --git a/DavidBerry.Framework/DavidBerry.Framework.Tests/TimeAndDate/StandardDateTimeProviderTests.cs b/DavidBerry.Framework/DavidBerry.Framework.Tests/TimeAndDate/StandardDateTimeProviderTests.cs index 4096f12..fe5b070 100644 --- a/DavidBerry.Framework/DavidBerry.Framework.Tests/TimeAndDate/StandardDateTimeProviderTests.cs +++ b/DavidBerry.Framework/DavidBerry.Framework.Tests/TimeAndDate/StandardDateTimeProviderTests.cs @@ -1,5 +1,5 @@ using DavidBerry.Framework.TimeAndDate; -using FluentAssertions; +using Shouldly; using System; using System.Collections.Generic; using System.Text; @@ -19,10 +19,10 @@ public void CurrentDateTime_ReturnsCurrentDateTime() // Act var result = dateTimeProvider.CurrentDateTime; - + // Assert - result.Should().BeCloseTo(controlTime, new TimeSpan(TimeSpan.TicksPerMillisecond * 100)); - result.Kind.Should().Be(DateTimeKind.Local); + result.ShouldBeInRange(controlTime.AddMilliseconds(-100), controlTime.AddMilliseconds(100)); + result.Kind.ShouldBe(DateTimeKind.Local); } [Fact] @@ -36,8 +36,8 @@ public void CurrentUtcDateTime_ReturnsCurrentUtcDateTime() var result = dateTimeProvider.CurrentUtcDateTime; // Assert - result.Should().BeCloseTo(controlTime, new TimeSpan(TimeSpan.TicksPerMillisecond * 100)); - result.Kind.Should().Be(DateTimeKind.Utc); + result.ShouldBeInRange(controlTime.AddMilliseconds(-100), controlTime.AddMilliseconds(100)); + result.Kind.ShouldBe(DateTimeKind.Utc); } @@ -52,8 +52,8 @@ public void Today_ReturnsToday() var result = dateTimeProvider.Today; // Assert - result.Should().Be(controlTime); - result.Kind.Should().Be(DateTimeKind.Local); + result.ShouldBe(controlTime); + result.Kind.ShouldBe(DateTimeKind.Local); } diff --git a/DavidBerry.Framework/DavidBerry.Framework.Tests/TimeAndDate/UnitTestDateTimeProviderTests.cs b/DavidBerry.Framework/DavidBerry.Framework.Tests/TimeAndDate/UnitTestDateTimeProviderTests.cs index 06a9f20..16f102f 100644 --- a/DavidBerry.Framework/DavidBerry.Framework.Tests/TimeAndDate/UnitTestDateTimeProviderTests.cs +++ b/DavidBerry.Framework/DavidBerry.Framework.Tests/TimeAndDate/UnitTestDateTimeProviderTests.cs @@ -1,5 +1,5 @@ using DavidBerry.Framework.TimeAndDate; -using FluentAssertions; +using Shouldly; using System; using System.Collections.Generic; using System.Text; @@ -21,14 +21,14 @@ public void CurrentDateTime_ReturnsCurrentDateTime() var result = dateTimeProvider.CurrentDateTime; // Assert - result.Year.Should().Be(2019); - result.Month.Should().Be(12); - result.Day.Should().Be(1); - result.Hour.Should().Be(11); - result.Minute.Should().Be(30); - result.Second.Should().Be(0); - - result.Kind.Should().Be(DateTimeKind.Local); + result.Year.ShouldBe(2019); + result.Month.ShouldBe(12); + result.Day.ShouldBe(1); + result.Hour.ShouldBe(11); + result.Minute.ShouldBe(30); + result.Second.ShouldBe(0); + + result.Kind.ShouldBe(DateTimeKind.Local); } @@ -45,14 +45,14 @@ public void CurrentUtcDateTime_ReturnsCurrentUtcDateTime() var result = dateTimeProvider.CurrentUtcDateTime; // Assert - result.Year.Should().Be(expectedDateTime.Year); - result.Month.Should().Be(expectedDateTime.Month); - result.Day.Should().Be(expectedDateTime.Day); - result.Hour.Should().Be(expectedDateTime.Hour); - result.Minute.Should().Be(expectedDateTime.Minute); - result.Second.Should().Be(expectedDateTime.Second); - - result.Kind.Should().Be(DateTimeKind.Utc); + result.Year.ShouldBe(expectedDateTime.Year); + result.Month.ShouldBe(expectedDateTime.Month); + result.Day.ShouldBe(expectedDateTime.Day); + result.Hour.ShouldBe(expectedDateTime.Hour); + result.Minute.ShouldBe(expectedDateTime.Minute); + result.Second.ShouldBe(expectedDateTime.Second); + + result.Kind.ShouldBe(DateTimeKind.Utc); } @@ -68,13 +68,13 @@ public void Today_ReturnsToday() var result = dateTimeProvider.Today; // Assert - result.Year.Should().Be(2019); - result.Month.Should().Be(12); - result.Day.Should().Be(1); - result.Hour.Should().Be(0); - result.Minute.Should().Be(0); - result.Second.Should().Be(0); - result.Kind.Should().Be(DateTimeKind.Local); + result.Year.ShouldBe(2019); + result.Month.ShouldBe(12); + result.Day.ShouldBe(1); + result.Hour.ShouldBe(0); + result.Minute.ShouldBe(0); + result.Second.ShouldBe(0); + result.Kind.ShouldBe(DateTimeKind.Local); } diff --git a/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/CollectionExtensionsTests.cs b/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/CollectionExtensionsTests.cs index b3a48e7..b6760a3 100644 --- a/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/CollectionExtensionsTests.cs +++ b/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/CollectionExtensionsTests.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; using DavidBerry.Framework.Util; -using FluentAssertions; +using Shouldly; using Xunit; namespace DavidBerry.Framework.Tests.Util @@ -16,7 +16,7 @@ public void TestNullListReturnsTrueFor_IsNullOrEmpty() var empty = states.IsNullOrEmpty(); - empty.Should().BeTrue(); + empty.ShouldBeTrue(); } [Fact] @@ -26,7 +26,7 @@ public void TestEmptyListReturnsTrueFor_IsNullOrEmpty() var empty = states.IsNullOrEmpty(); - empty.Should().BeTrue(); + empty.ShouldBeTrue(); } [Fact] @@ -36,7 +36,7 @@ public void TestListWithElementsReturnsFalseFor_IsNullOrEmpty() var empty = states.IsNullOrEmpty(); - empty.Should().BeFalse(); + empty.ShouldBeFalse(); } [Fact] @@ -46,7 +46,7 @@ public void TestNullDictionaryReturnsTrueFor_IsNullOrEmpty() var empty = states.IsNullOrEmpty(); - empty.Should().BeTrue(); + empty.ShouldBeTrue(); } @@ -57,7 +57,7 @@ public void TestEmptyDictionaryReturnsTrueFor_IsNullOrEmpty() var empty = states.IsNullOrEmpty(); - empty.Should().BeTrue(); + empty.ShouldBeTrue(); } @@ -75,7 +75,7 @@ public void TestDictionaryWithElementsReturnsFalseFor_IsNullOrEmpty() var empty = states.IsNullOrEmpty(); - empty.Should().BeFalse(); + empty.ShouldBeFalse(); } } diff --git a/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/DataRangeTests.cs b/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/DataRangeTests.cs index d2d479e..1208020 100644 --- a/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/DataRangeTests.cs +++ b/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/DataRangeTests.cs @@ -1,5 +1,5 @@ using DavidBerry.Framework.Util; -using FluentAssertions; +using Shouldly; using System; using System.Collections.Generic; using System.Text; @@ -17,8 +17,8 @@ public void Int32_ConstructorAcceptsValidArguments(int minimum, int maximum) { DataRange range = new DataRange(minimum, maximum); - range.Minimum.Should().Be(minimum); - range.Maximum.Should().Be(maximum); + range.Minimum.ShouldBe(minimum); + range.Maximum.ShouldBe(maximum); } @@ -42,7 +42,7 @@ public void Int32_ContainsValue_ShouldReturnTrue_ForMinimumValueInRange() var result = range.ContainsValue(0); - result.Should().BeTrue(); + result.ShouldBeTrue(); } [Fact] @@ -52,7 +52,7 @@ public void Int32_ContainsValue_ShouldReturnTrue_ForMaximumValueInRange() var result = range.ContainsValue(100); - result.Should().BeTrue(); + result.ShouldBeTrue(); } [Fact] @@ -62,7 +62,7 @@ public void Int32_ContainsValue_ShouldReturnTrue_ForValueInRange() var result = range.ContainsValue(45); - result.Should().BeTrue(); + result.ShouldBeTrue(); } [Fact] @@ -72,7 +72,7 @@ public void Int32_ContainsValue_ShouldReturnFalse_ForValueLowerThanRange() var result = range.ContainsValue(24); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -83,7 +83,7 @@ public void Int32_ContainsValue_ShouldReturnFalse_ForValueGreaterThanRange() var result = range.ContainsValue(101); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -97,7 +97,7 @@ public void Int32_ContainsRange_ShouldReturnTrue_ForRangeWithSameMinAndMax() var result = range.ContainsRange(other); - result.Should().BeTrue(); + result.ShouldBeTrue(); } [Fact] @@ -108,7 +108,7 @@ public void Int32_ContainsRange_ShouldReturnTrue_ForRangeWithSameMinAndLowerMax( var result = range.ContainsRange(other); - result.Should().BeTrue(); + result.ShouldBeTrue(); } [Fact] @@ -119,7 +119,7 @@ public void Int32_ContainsRange_ShouldReturnTrue_ForRangeWithGreaterMinAndSameMa var result = range.ContainsRange(other); - result.Should().BeTrue(); + result.ShouldBeTrue(); } @@ -131,7 +131,7 @@ public void Int32_ContainsRange_ShouldReturnTrue_ForRangeFullyContained() var result = range.ContainsRange(other); - result.Should().BeTrue(); + result.ShouldBeTrue(); } [Fact] @@ -142,7 +142,7 @@ public void Int32_ContainsRange_ShouldReturnFalse_ForRangeWithLowerMinAndGreater var result = range.ContainsRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -154,7 +154,7 @@ public void Int32_ContainsRange_ShouldReturnFalse_ForLowerOverlappingRange() var result = range.ContainsRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -166,7 +166,7 @@ public void Int32_ContainsRange_ShouldReturnFalse_ForHigherOverlappingRange() var result = range.ContainsRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -179,7 +179,7 @@ public void Int32_ContainsRange_ShouldReturnFalse_ForRangeWithSameMinGreaterMax( var result = range.ContainsRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -191,7 +191,7 @@ public void Int32_ContainsRange_ShouldReturnFalse_ForRangeWithLowerMinSameMax() var result = range.ContainsRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -214,7 +214,7 @@ public void Int32_IsInsideRange_ShouldReturnTrue_ForRangeWithSameMinAndMax() var result = range.IsInsideRange(other); - result.Should().BeTrue(); + result.ShouldBeTrue(); } [Fact] @@ -225,7 +225,7 @@ public void Int32_IsInsideRange_ShouldReturnTrue_ForRangeWithSameMinAndLowerMax( var result = range.IsInsideRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } [Fact] @@ -236,7 +236,7 @@ public void Int32_IsInsideRange_ShouldReturnTrue_ForRangeWithGreaterMinAndSameMa var result = range.IsInsideRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -248,7 +248,7 @@ public void Int32_IsInsideRange_ShouldReturnTrue_ForRangeFullyContained() var result = range.IsInsideRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } [Fact] @@ -259,7 +259,7 @@ public void Int32_IsInsideRange_ShouldReturnFalse_ForRangeWithLowerMinAndGreater var result = range.IsInsideRange(other); - result.Should().BeTrue(); + result.ShouldBeTrue(); } @@ -271,7 +271,7 @@ public void Int32_IsInsideRange_ShouldReturnFalse_ForLowerOverlappingRange() var result = range.IsInsideRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -283,7 +283,7 @@ public void Int32_IsInsideRange_ShouldReturnFalse_ForHigherOverlappingRange() var result = range.IsInsideRange(other); - result.Should().BeFalse(); + result.ShouldBeFalse(); } @@ -296,7 +296,7 @@ public void Int32_IsInsideRange_ShouldReturnFalse_ForRangeWithSameMinGreaterMax( var result = range.IsInsideRange(other); - result.Should().BeTrue(); + result.ShouldBeTrue(); } @@ -308,7 +308,7 @@ public void Int32_IsInsideRange_ShouldReturnFalse_ForRangeWithLowerMinSameMax() var result = range.IsInsideRange(other); - result.Should().BeTrue(); + result.ShouldBeTrue(); } [Fact] @@ -318,7 +318,7 @@ public void Int32_ToString_ReturnsProperlyFormattedString() var result = range.ToString(); - result.Should().Be("[10-20]"); + result.ShouldBe("[10-20]"); } diff --git a/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/LinqExtensionsTests.cs b/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/LinqExtensionsTests.cs index 1d825e3..7b58ca4 100644 --- a/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/LinqExtensionsTests.cs +++ b/DavidBerry.Framework/DavidBerry.Framework.Tests/Util/LinqExtensionsTests.cs @@ -3,7 +3,7 @@ using System.Text; using System.Linq; using Xunit; -using FluentAssertions; +using Shouldly; using DavidBerry.Framework.Util; namespace DavidBerry.Framework.Tests.Util @@ -30,11 +30,11 @@ public void TestWhereNotExistsSimpleStrings() var missingColors = colors.WhereNotExists(target, (x, y) => x == y).ToList(); // Assert - missingColors.Count.Should().Be(2); - missingColors.Should().Contain("Blue"); - missingColors.Should().Contain("White"); - missingColors.Should().NotContain("Red"); - missingColors.Should().NotContain("Green"); + missingColors.Count.ShouldBe(2); + missingColors.ShouldContain("Blue"); + missingColors.ShouldContain("White"); + missingColors.ShouldNotContain("Red"); + missingColors.ShouldNotContain("Green"); } @@ -56,11 +56,11 @@ public void TestWhereNotExistsObjectsNotInStringList() var missingItems = cars.WhereNotExists(colors, (x, y) => x.Color == y).ToList(); // Assert - missingItems.Count.Should().Be(2); - missingItems.Should().Contain(c => c.Color == "Silver"); // Has a silver car - missingItems.Should().Contain(c => c.Color == "Yellow"); // Has a yellow car - missingItems.Should().NotContain(c => c.Color == "Red"); // No Red Cars - missingItems.Should().NotContain(c => c.Color == "Green"); // No Green Cars + missingItems.Count.ShouldBe(2); + missingItems.ShouldContain(c => c.Color == "Silver"); // Has a silver car + missingItems.ShouldContain(c => c.Color == "Yellow"); // Has a yellow car + missingItems.ShouldNotContain(c => c.Color == "Red"); // No Red Cars + missingItems.ShouldNotContain(c => c.Color == "Green"); // No Green Cars } @@ -82,9 +82,9 @@ public void TestWhereNotExistsStringsNotInObjectList() var missingItems = colors.WhereNotExists(cars, (x, y) => x == y.Color).ToList(); // Assert - missingItems.Count.Should().Be(2); - missingItems.Should().Contain("White"); // There are no white cars - missingItems.Should().Contain("Blue"); // There are no blue cars + missingItems.Count.ShouldBe(2); + missingItems.ShouldContain("White"); // There are no white cars + missingItems.ShouldContain("Blue"); // There are no blue cars } @@ -107,12 +107,12 @@ public void TestWhereExistsObjectsInStringList() var matchingItems = cars.WhereExists(colors, (x, y) => x.Color == y).ToList(); // Assert - matchingItems.Count.Should().Be(2); - matchingItems.Should().NotContain(car => car.Color == "Silver"); // Silver is not in the color list - matchingItems.Should().NotContain(car => car.Color == "Yellow"); // Yellow is not in the color list + matchingItems.Count.ShouldBe(2); + matchingItems.ShouldNotContain(car => car.Color == "Silver"); // Silver is not in the color list + matchingItems.ShouldNotContain(car => car.Color == "Yellow"); // Yellow is not in the color list - matchingItems.Should().Contain(car => car.Color == "Red", "A red car is in the list and red is in the list of colors"); - matchingItems.Should().Contain(car => car.Color == "Green", "A green car is in the list and green is in the list of colors"); + matchingItems.ShouldContain(car => car.Color == "Red", "A red car is in the list and red is in the list of colors"); + matchingItems.ShouldContain(car => car.Color == "Green", "A green car is in the list and green is in the list of colors"); } @@ -134,13 +134,13 @@ public void TestWhereExistsStringsInObjectList() var matchingItems = colors.WhereExists(cars, (x, y) => x == y.Color).ToList(); // Assert - matchingItems.Count.Should().Be(2); + matchingItems.Count.ShouldBe(2); - matchingItems.Should().Contain("Red", "A red car is in the list and red is in the list of colors"); - matchingItems.Should().Contain("Green", "A green car is in the list and green is in the list of colors"); + matchingItems.ShouldContain("Red", "A red car is in the list and red is in the list of colors"); + matchingItems.ShouldContain("Green", "A green car is in the list and green is in the list of colors"); - matchingItems.Should().NotContain("Blue", "because there are no Blue cars"); - matchingItems.Should().NotContain("White", "because there are no white cars"); + matchingItems.ShouldNotContain("Blue", "because there are no Blue cars"); + matchingItems.ShouldNotContain("White", "because there are no white cars"); } diff --git a/DavidBerry.Framework/DavidBerry.Framework/DavidBerry.Framework.csproj b/DavidBerry.Framework/DavidBerry.Framework/DavidBerry.Framework.csproj index 197c77d..271d6e8 100644 --- a/DavidBerry.Framework/DavidBerry.Framework/DavidBerry.Framework.csproj +++ b/DavidBerry.Framework/DavidBerry.Framework/DavidBerry.Framework.csproj @@ -5,7 +5,7 @@ - +