From c6a15b1c96d60eb4e5a191a6eca7e47006ae49ca Mon Sep 17 00:00:00 2001 From: Lucas Maximiliano Marino Date: Tue, 16 May 2023 13:18:23 +0200 Subject: [PATCH] feat: update to dotnet7, turn off bottomify --- ...hankifi.Common.Filters.Abstractions.csproj | 4 +- .../FilterTests.cs | 61 +++++++++++++++++++ .../Thankifi.Common.Filters.Testing.csproj | 24 ++++++++ src/Thankifi.Common.Filters.Testing/Usings.cs | 1 + src/Thankifi.Common.Filters.sln | 6 ++ .../BottomifyFilter.cs | 44 ++++++------- .../ServiceCollectionExtensions.cs | 2 +- .../Thankifi.Common.Filters.csproj | 4 +- 8 files changed, 119 insertions(+), 27 deletions(-) create mode 100644 src/Thankifi.Common.Filters.Testing/FilterTests.cs create mode 100644 src/Thankifi.Common.Filters.Testing/Thankifi.Common.Filters.Testing.csproj create mode 100644 src/Thankifi.Common.Filters.Testing/Usings.cs diff --git a/src/Thankifi.Common.Filters.Abstractions/Thankifi.Common.Filters.Abstractions.csproj b/src/Thankifi.Common.Filters.Abstractions/Thankifi.Common.Filters.Abstractions.csproj index 620c5c8..1ee132a 100644 --- a/src/Thankifi.Common.Filters.Abstractions/Thankifi.Common.Filters.Abstractions.csproj +++ b/src/Thankifi.Common.Filters.Abstractions/Thankifi.Common.Filters.Abstractions.csproj @@ -1,7 +1,7 @@ - net5.0 + net7.0 enable true Thankifi.Common.Filters.Abstractions @@ -9,7 +9,7 @@ Lucas Maximiliano Marino https://github.com/thankifi/package.filters https://github.com/thankifi/package.filters - Copyright © Lucas Maximiliano Marino 2021 + Copyright © Lucas Maximiliano Marino 2023 diff --git a/src/Thankifi.Common.Filters.Testing/FilterTests.cs b/src/Thankifi.Common.Filters.Testing/FilterTests.cs new file mode 100644 index 0000000..a4a4e46 --- /dev/null +++ b/src/Thankifi.Common.Filters.Testing/FilterTests.cs @@ -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")); + } +} \ No newline at end of file diff --git a/src/Thankifi.Common.Filters.Testing/Thankifi.Common.Filters.Testing.csproj b/src/Thankifi.Common.Filters.Testing/Thankifi.Common.Filters.Testing.csproj new file mode 100644 index 0000000..79aeb66 --- /dev/null +++ b/src/Thankifi.Common.Filters.Testing/Thankifi.Common.Filters.Testing.csproj @@ -0,0 +1,24 @@ + + + + net7.0 + enable + enable + + false + + + + + + + + + + + + + + + + diff --git a/src/Thankifi.Common.Filters.Testing/Usings.cs b/src/Thankifi.Common.Filters.Testing/Usings.cs new file mode 100644 index 0000000..cefced4 --- /dev/null +++ b/src/Thankifi.Common.Filters.Testing/Usings.cs @@ -0,0 +1 @@ +global using NUnit.Framework; \ No newline at end of file diff --git a/src/Thankifi.Common.Filters.sln b/src/Thankifi.Common.Filters.sln index beee9b4..0cfe2c5 100644 --- a/src/Thankifi.Common.Filters.sln +++ b/src/Thankifi.Common.Filters.sln @@ -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 @@ -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 diff --git a/src/Thankifi.Common.Filters/BottomifyFilter.cs b/src/Thankifi.Common.Filters/BottomifyFilter.cs index bc64582..52a31f0 100644 --- a/src/Thankifi.Common.Filters/BottomifyFilter.cs +++ b/src/Thankifi.Common.Filters/BottomifyFilter.cs @@ -1,22 +1,22 @@ -using System.Threading; -using System.Threading.Tasks; -using Bottom; -using Thankifi.Common.Filters.Abstractions; - -namespace Thankifi.Common.Filters -{ - /// - /// Bottomify filter. - /// - public class BottomifyFilter : IFilter - { - /// - public string Identifier => "bottomify"; - - /// - public Task Apply(string str, CancellationToken cancellationToken = default) - { - return Task.FromResult(Bottomify.EncodeString(str)); - } - } -} \ No newline at end of file +// using System.Threading; +// using System.Threading.Tasks; +// using Bottom; +// using Thankifi.Common.Filters.Abstractions; +// +// namespace Thankifi.Common.Filters +// { +// /// +// /// Bottomify filter. +// /// +// public class BottomifyFilter : IFilter +// { +// /// +// public string Identifier => "bottomify"; +// +// /// +// public Task Apply(string str, CancellationToken cancellationToken = default) +// { +// return Task.FromResult(Bottomify.EncodeString(str)); +// } +// } +// } \ No newline at end of file diff --git a/src/Thankifi.Common.Filters/ServiceCollectionExtensions.cs b/src/Thankifi.Common.Filters/ServiceCollectionExtensions.cs index 8d05b60..b9235c5 100644 --- a/src/Thankifi.Common.Filters/ServiceCollectionExtensions.cs +++ b/src/Thankifi.Common.Filters/ServiceCollectionExtensions.cs @@ -19,7 +19,7 @@ public static IServiceCollection AddFilters(this IServiceCollection services) services.TryAddTransient(); services.AddTransient(); - services.AddTransient(); + // services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/src/Thankifi.Common.Filters/Thankifi.Common.Filters.csproj b/src/Thankifi.Common.Filters/Thankifi.Common.Filters.csproj index adf4e11..9cafede 100644 --- a/src/Thankifi.Common.Filters/Thankifi.Common.Filters.csproj +++ b/src/Thankifi.Common.Filters/Thankifi.Common.Filters.csproj @@ -1,7 +1,7 @@ - net5.0 + net7.0 enable true Thankifi.Common.Filters @@ -9,7 +9,7 @@ Lucas Maximiliano Marino https://github.com/thankifi/package.filters https://github.com/thankifi/package.filters - Copyright © Lucas Maximiliano Marino 2021 + Copyright © Lucas Maximiliano Marino 2023