Skip to content

Commit 949264a

Browse files
authored
Merge pull request #3 from astar-development/features/add-tests
Add the required tests
2 parents a05a0af + d95b614 commit 949264a

14 files changed

+98
-22
lines changed

src/AStar.Dev.Utilities/AStar.Dev.Utilities.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
<RepositoryType>git</RepositoryType>
3030
<PackageProjectUrl>https://github.com/jbarden/astar-dev-utilities</PackageProjectUrl>
3131
<Description>A collection of useful utilities.</Description>
32-
<Version>1.5.0</Version>
32+
<Version>1.5.1</Version>
3333
<Authors>AStar Development, Jason Barden</Authors>
3434
<DocumentationFile>$(AssemblyName).xml</DocumentationFile>
3535
<PackageIcon>AStar.png</PackageIcon>
3636
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
37-
<PackageReleaseNotes>version 1.5.0 contains the initial code port from the jbarden NuGet / GitHub organisations.</PackageReleaseNotes>
37+
<PackageReleaseNotes>version 1.5.1 adds the missing tests, no functionality is affected.</PackageReleaseNotes>
3838
</PropertyGroup>
3939

4040
<ItemGroup>

src/AStar.Dev.Utilities/AStar.Dev.Utilities.xml

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AStar.Dev.Utilities/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Text.Json;
22

3-
namespace AStar.Utilities;
3+
namespace AStar.Dev.Utilities;
44

55
/// <summary>
66
/// The <see href="Constants"></see>see> class contains static / constant properties to simplify and centralise various settings.
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
namespace AStar.Utilities;
1+
namespace AStar.Dev.Utilities;
22

33
/// <summary>
44
///
55
/// </summary>
66
public static class EnumExtensions
77
{
88
/// <summary>
9-
///
9+
/// The ParseEnum method will parse the supplied string and return the matching enum value.
1010
/// </summary>
11-
/// <typeparam name="T"></typeparam>
12-
/// <param name="value"></param>
13-
/// <returns></returns>
11+
/// <typeparam name="T">The typeof of the expected enum.</typeparam>
12+
/// <param name="value">The value to parse to the enum.</param>
13+
/// <returns>The parsed value as the matching enum value.</returns>
14+
/// <exception cref="ArgumentException">Thrown when the string is not a valid enum value.</exception>
1415
public static T ParseEnum<T>(this string value) => (T)Enum.Parse(typeof(T), value, true);
1516
}

src/AStar.Dev.Utilities/ObjectExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Text.Json;
22

3-
namespace AStar.Utilities;
3+
namespace AStar.Dev.Utilities;
44

55
/// <summary>
66
/// The <see cref="ObjectExtensions" /> class contains some useful methods to enable various tasks

src/AStar.Dev.Utilities/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Text.Json;
22

3-
namespace AStar.Utilities;
3+
namespace AStar.Dev.Utilities;
44

55
/// <summary>
66
/// The <see cref="StringExtensions" /> class contains some useful methods to enable checks to be

tests/unit/AStar.Dev.Utilities.Unit.Tests/AStar.Dev.Utilities.Unit.Tests.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1515
<PrivateAssets>all</PrivateAssets>
1616
</PackageReference>
17+
<PackageReference Include="FluentAssertions" Version="6.12.1" />
1718
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
1819
<PackageReference Include="xunit" Version="2.9.2" />
1920
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
@@ -27,6 +28,7 @@
2728
</ItemGroup>
2829

2930
<ItemGroup>
31+
<Using Include="FluentAssertions" />
3032
<Using Include="Xunit" />
3133
</ItemGroup>
3234

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace AStar.Dev.Utilities.Unit.Tests;
2+
3+
internal class AnyClass
4+
{
5+
public int AnyInt { get; set; }
6+
7+
public string AnyString { get; set; } = string.Empty;
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace AStar.Dev.Utilities.Unit.Tests;
2+
3+
internal enum AnyEnum
4+
{
5+
NotDefined,
6+
Defined
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace AStar.Dev.Utilities.Unit.Tests;
2+
3+
public class ConstantsShould
4+
{
5+
[Fact]
6+
public void ContainTheExpectedWebDeserialisationSettingsSetting()
7+
=> Constants.WebDeserialisationSettings
8+
.ToJson()
9+
.Should()
10+
.Be("{\"Converters\":[],\"TypeInfoResolver\":null,\"TypeInfoResolverChain\":[],\"AllowTrailingCommas\":false,\"DefaultBufferSize\":16384,\"Encoder\":null,\"DictionaryKeyPolicy\":null,\"IgnoreNullValues\":false,\"DefaultIgnoreCondition\":0,\"NumberHandling\":1,\"PreferredObjectCreationHandling\":0,\"IgnoreReadOnlyProperties\":false,\"IgnoreReadOnlyFields\":false,\"IncludeFields\":false,\"MaxDepth\":0,\"PropertyNamingPolicy\":{},\"PropertyNameCaseInsensitive\":true,\"ReadCommentHandling\":0,\"UnknownTypeHandling\":0,\"UnmappedMemberHandling\":0,\"WriteIndented\":false,\"ReferenceHandler\":null,\"IsReadOnly\":false}");
11+
}

0 commit comments

Comments
 (0)