From ff00b7e1da20c20e9705e8397fde60043101383a Mon Sep 17 00:00:00 2001 From: Mateusz Noga-Wojtania Date: Fri, 30 Jan 2026 15:13:07 +0100 Subject: [PATCH 1/3] add dotenv --- .../Frends.Echo.Execute.Tests/.env.example | 2 + .../Frends.Echo.Execute.Tests.csproj | 5 ++- .../IntegrationTests.cs | 41 +++++++++++++++++++ .../Frends.Echo.Execute.Tests/TestBase.cs | 15 +++++++ .../Frends.Echo.Execute.Tests/UnitTests.cs | 23 ----------- FrendsTaskTemplate.csproj | 14 ++++--- 6 files changed, 69 insertions(+), 31 deletions(-) create mode 100644 Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/.env.example create mode 100644 Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/IntegrationTests.cs create mode 100644 Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/TestBase.cs delete mode 100644 Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/UnitTests.cs 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/IntegrationTests.cs b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/IntegrationTests.cs new file mode 100644 index 0000000..087fd9b --- /dev/null +++ b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/IntegrationTests.cs @@ -0,0 +1,41 @@ +using System.Threading; +using Frends.Echo.Execute.Definitions; +using NUnit.Framework; + +namespace Frends.Echo.Execute.Tests; + +[TestFixture] +public class IntegrationTests : TestBase +{ + [Test] + public void TestEnvironmentVariables() + { + Assert.That(SecretKey, Is.EqualTo("example"), SecretKey); + } + + [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 = Xml.Write(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..22e8a81 --- /dev/null +++ b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/TestBase.cs @@ -0,0 +1,15 @@ +using System; +using dotenv.net; + +namespace Frends.Xml.Write.Tests; + +public abstract class TestBase +{ + protected TestBase() + { + DotEnv.Load(); + SecretKey = Environment.GetEnvironmentVariable("FRENDS_SECRET_KEY"); + } + + 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..d781958 100644 --- a/FrendsTaskTemplate.csproj +++ b/FrendsTaskTemplate.csproj @@ -2,7 +2,7 @@ Template - 1.7.0 + 1.7.1 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 - - - + + + From d5dab94c50dca51a1f604ca1424e4616676d3fa7 Mon Sep 17 00:00:00 2001 From: Mateusz Noga-Wojtania Date: Fri, 30 Jan 2026 15:13:35 +0100 Subject: [PATCH 2/3] fix version --- FrendsTaskTemplate.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FrendsTaskTemplate.csproj b/FrendsTaskTemplate.csproj index d781958..806d96d 100644 --- a/FrendsTaskTemplate.csproj +++ b/FrendsTaskTemplate.csproj @@ -2,7 +2,7 @@ Template - 1.7.1 + 1.8.0 frendstasktemplate Frends Task template Frends From 7eb839386e5692deb20d43672dc5f9738a319b22 Mon Sep 17 00:00:00 2001 From: Mateusz Noga-Wojtania Date: Tue, 3 Feb 2026 08:52:16 +0100 Subject: [PATCH 3/3] cr changes --- .../{IntegrationTests.cs => FunctionalTests.cs} | 10 ++-------- .../Frends.Echo.Execute.Tests/TestBase.cs | 4 +++- 2 files changed, 5 insertions(+), 9 deletions(-) rename Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/{IntegrationTests.cs => FunctionalTests.cs} (72%) diff --git a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/IntegrationTests.cs b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/FunctionalTests.cs similarity index 72% rename from Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/IntegrationTests.cs rename to Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/FunctionalTests.cs index 087fd9b..47dbc19 100644 --- a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/IntegrationTests.cs +++ b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/FunctionalTests.cs @@ -5,14 +5,8 @@ namespace Frends.Echo.Execute.Tests; [TestFixture] -public class IntegrationTests : TestBase +public class FunctionalTests : TestBase { - [Test] - public void TestEnvironmentVariables() - { - Assert.That(SecretKey, Is.EqualTo("example"), SecretKey); - } - [Test] public void ShouldRepeatContentWithDelimiter() { @@ -34,7 +28,7 @@ public void ShouldRepeatContentWithDelimiter() ErrorMessageOnFailure = null, }; - var result = Xml.Write(input, connection, options, CancellationToken.None); + 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 index 22e8a81..df1656a 100644 --- a/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/TestBase.cs +++ b/Frends.Template/Frends.Echo.Execute/Frends.Echo.Execute.Tests/TestBase.cs @@ -1,15 +1,17 @@ using System; using dotenv.net; -namespace Frends.Xml.Write.Tests; +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; } }