-
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.
* Merge pull request #2 from chrisjbreisch/dev (#3) * small naming fixes, unit tests * Merge pull request #2 from chrisjbreisch/dev (#4)
- Loading branch information
1 parent
3fcc4d3
commit 69e10e9
Showing
9 changed files
with
387 additions
and
136 deletions.
There are no files selected for viewing
155 changes: 155 additions & 0 deletions
155
Trs80.Level1Basic.Extensions.Test/StringExtensionsTest.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,155 @@ | ||
using FluentAssertions; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Trs80.Level1Basic.Common.Extensions; | ||
|
||
namespace Trs80.Level1Basic.Extensions.Test | ||
{ | ||
[TestClass] | ||
public class StringExtensionsTest | ||
{ | ||
private const string testString = "four Score-and_seven_YeArs AGO"; | ||
private const string testOneWordString = "fOUr"; | ||
private const string testUpperOneLetterString = "F"; | ||
private const string testLowerOneLetterString = "f"; | ||
|
||
[TestMethod] | ||
public void Can_Convert_String_To_Pascal_Case() | ||
{ | ||
string? result = testString.ToPascalCase(); | ||
result.Should().Be("FourScoreAndSevenYearsAgo"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_String_To_Camel_Case() | ||
{ | ||
string? result = testString.ToCamelCase(); | ||
result.Should().Be("fourScoreAndSevenYearsAgo"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_String_To_Snake_Case() | ||
{ | ||
string? result = testString.ToSnakeCase(); | ||
result.Should().Be("four_score_and_seven_years_ago"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_String_To_Caps_Case() | ||
{ | ||
string? result = testString.ToCapsCase(); | ||
result.Should().Be("FOUR_SCORE_AND_SEVEN_YEARS_AGO"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_String_To_Kebab_Case() | ||
{ | ||
string? result = testString.ToKebabCase(); | ||
result.Should().Be("four-score-and-seven-years-ago"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Word_String_To_Pascal_Case() | ||
{ | ||
string? result = testOneWordString.ToPascalCase(); | ||
result.Should().Be("Four"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Word_String_To_Camel_Case() | ||
{ | ||
string? result = testOneWordString.ToCamelCase(); | ||
result.Should().Be("four"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Word_String_To_Snake_Case() | ||
{ | ||
string? result = testOneWordString.ToSnakeCase(); | ||
result.Should().Be("four"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Word_String_To_Caps_Case() | ||
{ | ||
string? result = testOneWordString.ToCapsCase(); | ||
result.Should().Be("FOUR"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Word_String_To_Kebab_Case() | ||
{ | ||
string? result = testOneWordString.ToKebabCase(); | ||
result.Should().Be("four"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Upper_String_To_Pascal_Case() | ||
{ | ||
string? result = testUpperOneLetterString.ToPascalCase(); | ||
result.Should().Be("F"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Upper_String_To_Camel_Case() | ||
{ | ||
string? result = testUpperOneLetterString.ToCamelCase(); | ||
result.Should().Be("f"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Upper_String_To_Snake_Case() | ||
{ | ||
string? result = testUpperOneLetterString.ToSnakeCase(); | ||
result.Should().Be("f"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Upper_String_To_Caps_Case() | ||
{ | ||
string? result = testUpperOneLetterString.ToCapsCase(); | ||
result.Should().Be("F"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Upper_String_To_Kebab_Case() | ||
{ | ||
string? result = testUpperOneLetterString.ToKebabCase(); | ||
result.Should().Be("f"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Lower_String_To_Pascal_Case() | ||
{ | ||
string? result = testLowerOneLetterString.ToPascalCase(); | ||
result.Should().Be("F"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Lower_String_To_Camel_Case() | ||
{ | ||
string? result = testLowerOneLetterString.ToCamelCase(); | ||
result.Should().Be("f"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Lower_String_To_Snake_Case() | ||
{ | ||
string? result = testLowerOneLetterString.ToSnakeCase(); | ||
result.Should().Be("f"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Lower_String_To_Caps_Case() | ||
{ | ||
string? result = testLowerOneLetterString.ToCapsCase(); | ||
result.Should().Be("F"); | ||
} | ||
|
||
[TestMethod] | ||
public void Can_Convert_One_Letter_Lower_String_To_Kebab_Case() | ||
{ | ||
string? result = testLowerOneLetterString.ToKebabCase(); | ||
result.Should().Be("f"); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Trs80.Level1Basic.Extensions.Test/Trs80.Level1Basic.Extensions.Test.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,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="6.6.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" /> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Trs80.Level1Basic.Extensions\Trs80.Level1Basic.Common.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
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
Oops, something went wrong.