Skip to content

Commit 2d609d0

Browse files
committed
Add the tests from the other project
And add any missing ones / fix bugs in the original code
1 parent 0b00883 commit 2d609d0

19 files changed

+450
-107
lines changed

DatabaseTesting.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Infrastructure.Te
4040
EndProject
4141
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Infrastructure.FilesDb.Tests.Unit", "test\AStar.Dev.Infrastructure.FilesDb.Tests.Unit\AStar.Dev.Infrastructure.FilesDb.Tests.Unit.csproj", "{019990B2-EFCD-4FB1-9FD1-CD98CCBFF670}"
4242
EndProject
43+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Utilities.Tests.Unit", "test\AStar.Dev.Utilities.Tests.Unit\AStar.Dev.Utilities.Tests.Unit.csproj", "{55EB2B02-1528-45B8-A460-93F269527272}"
44+
EndProject
45+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Technical.Debt.Reporting.Tests.Unit", "test\AStar.Dev.Technical.Debt.Reporting.Tests.Unit\AStar.Dev.Technical.Debt.Reporting.Tests.Unit.csproj", "{3C872AF9-A2A3-4CB8-B7BB-FC1BC3B57A82}"
46+
EndProject
4347
Global
4448
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4549
Debug|Any CPU = Debug|Any CPU
@@ -78,6 +82,14 @@ Global
7882
{019990B2-EFCD-4FB1-9FD1-CD98CCBFF670}.Debug|Any CPU.Build.0 = Debug|Any CPU
7983
{019990B2-EFCD-4FB1-9FD1-CD98CCBFF670}.Release|Any CPU.ActiveCfg = Release|Any CPU
8084
{019990B2-EFCD-4FB1-9FD1-CD98CCBFF670}.Release|Any CPU.Build.0 = Release|Any CPU
85+
{55EB2B02-1528-45B8-A460-93F269527272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
86+
{55EB2B02-1528-45B8-A460-93F269527272}.Debug|Any CPU.Build.0 = Debug|Any CPU
87+
{55EB2B02-1528-45B8-A460-93F269527272}.Release|Any CPU.ActiveCfg = Release|Any CPU
88+
{55EB2B02-1528-45B8-A460-93F269527272}.Release|Any CPU.Build.0 = Release|Any CPU
89+
{3C872AF9-A2A3-4CB8-B7BB-FC1BC3B57A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
90+
{3C872AF9-A2A3-4CB8-B7BB-FC1BC3B57A82}.Debug|Any CPU.Build.0 = Debug|Any CPU
91+
{3C872AF9-A2A3-4CB8-B7BB-FC1BC3B57A82}.Release|Any CPU.ActiveCfg = Release|Any CPU
92+
{3C872AF9-A2A3-4CB8-B7BB-FC1BC3B57A82}.Release|Any CPU.Build.0 = Release|Any CPU
8193
EndGlobalSection
8294
GlobalSection(SolutionProperties) = preSolution
8395
HideSolutionNode = FALSE
@@ -96,5 +108,7 @@ Global
96108
{626B3E85-6C5D-4D8B-96BB-BF2D375326CA} = {D61F13DC-3A32-42BE-8687-F795D7332A51}
97109
{1EC059E7-7C8D-4492-8C07-30BD79AEE465} = {D96E7D57-B3CF-4792-8532-59F03453A8B6}
98110
{019990B2-EFCD-4FB1-9FD1-CD98CCBFF670} = {D96E7D57-B3CF-4792-8532-59F03453A8B6}
111+
{55EB2B02-1528-45B8-A460-93F269527272} = {D96E7D57-B3CF-4792-8532-59F03453A8B6}
112+
{3C872AF9-A2A3-4CB8-B7BB-FC1BC3B57A82} = {D96E7D57-B3CF-4792-8532-59F03453A8B6}
99113
EndGlobalSection
100114
EndGlobal

support/AStar.Dev.Utilities/AStar.Dev.Utilities.xml

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

support/AStar.Dev.Utilities/RegexExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ public static bool ContainsAtLeastOneDigit(this string value) =>
3434
public static bool ContainsAtLeastOneSpecialCharacter(this string value) =>
3535
SpecialCharacterRegex().IsMatch(value);
3636

37-
[GeneratedRegex("^[a-z]+$", RegexOptions.CultureInvariant, 1_000)]
37+
[GeneratedRegex("[a-z]", RegexOptions.CultureInvariant, 1_000)]
3838
private static partial Regex LowercaseLettersRegex();
3939

40-
[GeneratedRegex("^[A-Z]+$", RegexOptions.CultureInvariant, 1_000)]
40+
[GeneratedRegex("[A-Z]", RegexOptions.CultureInvariant, 1_000)]
4141
private static partial Regex UppercaseLettersRegex();
4242

43-
[GeneratedRegex("^[A-Z]+$", RegexOptions.CultureInvariant, 1_000)]
43+
[GeneratedRegex("[0-9]", RegexOptions.CultureInvariant, 1_000)]
4444
private static partial Regex DigitRegex();
4545

46-
[GeneratedRegex(@"[!-\/:-@[-`{-~]", RegexOptions.CultureInvariant, 1_000)]
46+
[GeneratedRegex(@"[!-\/:-@[-`¬{-~]", RegexOptions.CultureInvariant, 1_000)]
4747
private static partial Regex SpecialCharacterRegex();
4848
}

support/AStar.Dev.Utilities/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static bool IsNumberOnly(this string fileName) =>
8888
/// <param name="truncateLength">The maximum length the string should be truncated to if required</param>
8989
/// <returns>The specified string or the truncated version</returns>
9090
public static string TruncateIfRequired(this string value, int truncateLength) =>
91-
value.Length > truncateLength ? value[..350] : value;
91+
value.Length > truncateLength ? value[..truncateLength] : value;
9292

9393
/// <summary>
9494
/// The RemoveTrailing method will, as the name suggests, remove the specified character from the end if it exists

support/DbContextHelpers/Fixtures/MockFilesContext.cs

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<IsPackable>false</IsPackable>
8+
<RootNamespace>AStar.Dev.Technical.Debt.Reporting</RootNamespace>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage"/>
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
17+
<PackageReference Include="coverlet.collector" Version="6.0.4">
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20+
</PackageReference>
21+
<PackageReference Include="Shouldly" Version="4.3.0"/>
22+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1"/>
23+
<PackageReference Include="xunit" Version="2.9.3"/>
24+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.3">
25+
<PrivateAssets>all</PrivateAssets>
26+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
27+
</PackageReference>
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<Using Include="Xunit"/>
32+
<Using Include="Shouldly"/>
33+
</ItemGroup>
34+
35+
<ItemGroup>
36+
<ProjectReference Include="..\..\support\AStar.Dev.Technical.Debt.Reporting\AStar.Dev.Technical.Debt.Reporting.csproj"/>
37+
</ItemGroup>
38+
39+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
40+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
41+
<NoWarn>1701;1702;IDE0058;</NoWarn>
42+
</PropertyGroup>
43+
44+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
45+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
46+
<NoWarn>1701;1702;IDE0058;</NoWarn>
47+
</PropertyGroup>
48+
49+
</Project>

0 commit comments

Comments
 (0)