diff --git a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/.env.example b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/.env.example new file mode 100644 index 0000000..05e9fb1 --- /dev/null +++ b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/.env.example @@ -0,0 +1,2 @@ +#Rename this file to .env to run tests locally +FRENDS_SECRET_KEY="example" diff --git a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/Frends.Echo.Execute.Tests.csproj b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/Frends.Echo.Execute.Tests.csproj index a7ea522..40e9555 100644 --- a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/Frends.Echo.Execute.Tests.csproj +++ b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/Frends.Echo.Execute.Tests.csproj @@ -12,8 +12,9 @@ - + - + + diff --git a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/FunctionalTests.cs b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/FunctionalTests.cs new file mode 100644 index 0000000..47dbc19 --- /dev/null +++ b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/FunctionalTests.cs @@ -0,0 +1,35 @@ +using System.Threading; +using Frends.Echo.Execute.Definitions; +using NUnit.Framework; + +namespace Frends.Echo.Execute.Tests; + +[TestFixture] +public class FunctionalTests : TestBase +{ + [Test] + public void ShouldRepeatContentWithDelimiter() + { + var input = new Input + { + Content = "foobar", + Repeat = 3, + }; + + var connection = new Connection + { + ConnectionString = "Host=127.0.0.1;Port=12345", + }; + + var options = new Options + { + Delimiter = ", ", + ThrowErrorOnFailure = true, + ErrorMessageOnFailure = null, + }; + + var result = Echo.Execute(input, connection, options, CancellationToken.None); + + Assert.That(result.Output, Is.EqualTo("foobar, foobar, foobar")); + } +} diff --git a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/TestBase.cs b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/TestBase.cs new file mode 100644 index 0000000..df1656a --- /dev/null +++ b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/TestBase.cs @@ -0,0 +1,17 @@ +using System; +using dotenv.net; + +namespace Frends.Echo.Execute.Tests; + +public abstract class TestBase +{ + protected TestBase() + { + // TODO: Here you can load environment variables used in tests + DotEnv.Load(); + SecretKey = Environment.GetEnvironmentVariable("FRENDS_SECRET_KEY"); + } + + // TODO: Replace with your secret key or remove if not needed + protected string SecretKey { get; } +} diff --git a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/UnitTests.cs b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/UnitTests.cs deleted file mode 100644 index 16ffc59..0000000 --- a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/UnitTests.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Threading; -using Frends.Echo.Execute.Definitions; -using NUnit.Framework; - -namespace Frends.Echo.Execute.Tests; - -[TestFixture] -public class UnitTests -{ - [Test] - public void ShouldRepeatContentWithDelimiter() - { - var input = new Input { Content = "foobar", Repeat = 3 }; - - var connection = new Connection { ConnectionString = "Host=127.0.0.1;Port=12345" }; - - var options = new Options { Delimiter = ", ", ThrowErrorOnFailure = true, ErrorMessageOnFailure = null }; - - var result = Echo.Execute(input, connection, options, CancellationToken.None); - - Assert.That(result.Output, Is.EqualTo("foobar, foobar, foobar")); - } -} diff --git a/FrendsTaskTemplate.csproj b/FrendsTaskTemplate.csproj index a2e195d..806d96d 100644 --- a/FrendsTaskTemplate.csproj +++ b/FrendsTaskTemplate.csproj @@ -2,7 +2,7 @@ Template - 1.7.0 + 1.8.0 frendstasktemplate Frends Task template Frends @@ -10,17 +10,19 @@ https://github.com/FrendsPlatform/FrendsTaskTemplate dotnet-new;templates;frends net8.0 + README.md true - false content - true - - - + + +