-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
538e777
commit d5f88cd
Showing
4 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
Behavioral/DesignPatterns.Visitor.UnitTests/DesignPatterns.Visitor.UnitTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<RootNamespace>DesignPatterns.Visitor.UnitTests</RootNamespace> | ||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AutoFixture" Version="4.18.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageReference Include="Moq" Version="4.20.70" /> | ||
<PackageReference Include="Shouldly" Version="4.2.1" /> | ||
<PackageReference Include="xunit" Version="2.6.5" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.msbuild" Version="6.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\DesignPatterns.Visitor\DesignPatterns.Visitor.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
27 changes: 27 additions & 0 deletions
27
Behavioral/DesignPatterns.Visitor.UnitTests/StringVisitor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using DesignPatterns.Visitor.Models; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
namespace DesignPatterns.Visitor.UnitTests; | ||
|
||
public class StringVisitorTests | ||
{ | ||
[Theory] | ||
[InlineData("256KB", 256, typeof(SizeInKiloBytes))] | ||
[InlineData("512 KB", 512, typeof(SizeInKiloBytes))] | ||
[InlineData("256MB", 256, typeof(SizeInMegaBytes))] | ||
[InlineData("512 MB", 512, typeof(SizeInMegaBytes))] | ||
[InlineData("256GB", 256, typeof(SizeInGigaBytes))] | ||
[InlineData("512 GB", 512, typeof(SizeInGigaBytes))] | ||
[InlineData("256TB", 256, typeof(SizeInTeraBytes))] | ||
[InlineData("512 TB", 512, typeof(SizeInTeraBytes))] | ||
[InlineData("256PB", 256, typeof(SizeInPetaBytes))] | ||
[InlineData("512 PB", 512, typeof(SizeInPetaBytes))] | ||
public void GivenStringValue_WhenCallVisit_ThenResultAsExpected(string inputValue, long expectedValue, Type expectedType) | ||
{ | ||
var stringVisitor = new StringVisitor(); | ||
var result = stringVisitor.Visit(inputValue); | ||
result.ShouldBeOfType(expectedType); | ||
result.Value.ShouldBe(expectedValue); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters