Skip to content

Commit

Permalink
feat: update to dotnet7, turn off bottomify
Browse files Browse the repository at this point in the history
  • Loading branch information
elementh committed May 16, 2023
1 parent 74d4705 commit c6a15b1
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Title>Thankifi.Common.Filters.Abstractions</Title>
<Description>Abstractions for common filters to have fun with strings.</Description>
<Authors>Lucas Maximiliano Marino</Authors>
<PackageProjectUrl>https://github.com/thankifi/package.filters</PackageProjectUrl>
<RepositoryUrl>https://github.com/thankifi/package.filters</RepositoryUrl>
<Copyright>Copyright © Lucas Maximiliano Marino 2021</Copyright>
<Copyright>Copyright © Lucas Maximiliano Marino 2023</Copyright>
</PropertyGroup>

</Project>
61 changes: 61 additions & 0 deletions src/Thankifi.Common.Filters.Testing/FilterTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Thankifi.Common.Filters.Abstractions;

namespace Thankifi.Common.Filters.Testing;

public class FilterTests
{
private IFilterService _service = null!;

[SetUp]
public void Setup()
{
_service = new FilterService(new IFilter[]
{
new BinaryFilter(),
// new BottomifyFilter(),
new LeetFilter(),
new MockFilter(),
new ShoutingFilter()
});
}

[Test]
public async Task CanDoBinary()
{
var text = await _service.Apply("binary", "This is a Test");

Assert.That(text, Is.EqualTo("10101001101000110100111100111000001101001111001110000011000011000001010100110010111100111110100"));
}

// [Test]
// public async Task CanDoBottomify()
// {
// var text = await _service.Apply("bottomify", "This is a Test");
//
// Assert.That(text, Is.EqualTo(""));
// }

[Test]
public async Task CanDoLeet()
{
var text = await _service.Apply("leet", "This is a Test");

Assert.That(text, Is.EqualTo("7h15 15 4 7357"));
}

[Test]
public async Task CanDoMock()
{
var text = await _service.Apply("mock", "This is a Test");

Assert.That(text, Is.EqualTo("tHiS iS a TeSt"));
}

[Test]
public async Task CanDoShouting()
{
var text = await _service.Apply("shouting", "This is a Test");

Assert.That(text, Is.EqualTo("THIS IS A TEST"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Thankifi.Common.Filters.Abstractions\Thankifi.Common.Filters.Abstractions.csproj" />
<ProjectReference Include="..\Thankifi.Common.Filters\Thankifi.Common.Filters.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/Thankifi.Common.Filters.Testing/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using NUnit.Framework;
6 changes: 6 additions & 0 deletions src/Thankifi.Common.Filters.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thankifi.Common.Filters", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thankifi.Common.Filters.Abstractions", "Thankifi.Common.Filters.Abstractions\Thankifi.Common.Filters.Abstractions.csproj", "{1A10545A-B386-4F0D-974B-DE41C2BBA617}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thankifi.Common.Filters.Testing", "Thankifi.Common.Filters.Testing\Thankifi.Common.Filters.Testing.csproj", "{5FD046EC-1636-4EDB-AC69-0A147277E6F1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -18,5 +20,9 @@ Global
{1A10545A-B386-4F0D-974B-DE41C2BBA617}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A10545A-B386-4F0D-974B-DE41C2BBA617}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A10545A-B386-4F0D-974B-DE41C2BBA617}.Release|Any CPU.Build.0 = Release|Any CPU
{5FD046EC-1636-4EDB-AC69-0A147277E6F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FD046EC-1636-4EDB-AC69-0A147277E6F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FD046EC-1636-4EDB-AC69-0A147277E6F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FD046EC-1636-4EDB-AC69-0A147277E6F1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
44 changes: 22 additions & 22 deletions src/Thankifi.Common.Filters/BottomifyFilter.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
using System.Threading;
using System.Threading.Tasks;
using Bottom;
using Thankifi.Common.Filters.Abstractions;

namespace Thankifi.Common.Filters
{
/// <summary>
/// Bottomify filter.
/// </summary>
public class BottomifyFilter : IFilter
{
/// <inheritdoc />
public string Identifier => "bottomify";

/// <inheritdoc />
public Task<string> Apply(string str, CancellationToken cancellationToken = default)
{
return Task.FromResult(Bottomify.EncodeString(str));
}
}
}
// using System.Threading;
// using System.Threading.Tasks;
// using Bottom;
// using Thankifi.Common.Filters.Abstractions;
//
// namespace Thankifi.Common.Filters
// {
// /// <summary>
// /// Bottomify filter.
// /// </summary>
// public class BottomifyFilter : IFilter
// {
// /// <inheritdoc />
// public string Identifier => "bottomify";
//
// /// <inheritdoc />
// public Task<string> Apply(string str, CancellationToken cancellationToken = default)
// {
// return Task.FromResult(Bottomify.EncodeString(str));
// }
// }
// }
2 changes: 1 addition & 1 deletion src/Thankifi.Common.Filters/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static IServiceCollection AddFilters(this IServiceCollection services)
services.TryAddTransient<IFilterService, FilterService>();

services.AddTransient<IFilter, BinaryFilter>();
services.AddTransient<IFilter, BottomifyFilter>();
// services.AddTransient<IFilter, BottomifyFilter>();
services.AddTransient<IFilter, LeetFilter>();
services.AddTransient<IFilter, MockFilter>();
services.AddTransient<IFilter, ShoutingFilter>();
Expand Down
4 changes: 2 additions & 2 deletions src/Thankifi.Common.Filters/Thankifi.Common.Filters.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Title>Thankifi.Common.Filters</Title>
<Description>Common filters to have fun with strings.</Description>
<Authors>Lucas Maximiliano Marino</Authors>
<PackageProjectUrl>https://github.com/thankifi/package.filters</PackageProjectUrl>
<RepositoryUrl>https://github.com/thankifi/package.filters</RepositoryUrl>
<Copyright>Copyright © Lucas Maximiliano Marino 2021</Copyright>
<Copyright>Copyright © Lucas Maximiliano Marino 2023</Copyright>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit c6a15b1

Please sign in to comment.