diff --git a/EnvelopeGenerator.Application/Common/Extensions/StringExtension.cs b/EnvelopeGenerator.Application/Common/Extensions/StringExtension.cs index 25a81c38..b9d34c3e 100644 --- a/EnvelopeGenerator.Application/Common/Extensions/StringExtension.cs +++ b/EnvelopeGenerator.Application/Common/Extensions/StringExtension.cs @@ -1,14 +1,30 @@ using OtpNet; -namespace EnvelopeGenerator.Application.Common.Extensions +namespace EnvelopeGenerator.Application.Common.Extensions; + +/// +/// +/// +public static class StringExtension { - public static class StringExtension + /// + /// + /// + /// + /// + /// + public static bool IsValidTotp(this string totp, string secret) { - public static bool IsValidTotp(this string totp, string secret) - { - var secret_bytes = Base32Encoding.ToBytes(secret); - var secret_totp = new Totp(secret_bytes); - return secret_totp.VerifyTotp(totp, out _, VerificationWindow.RfcSpecifiedNetworkDelay); - } + var secret_bytes = Base32Encoding.ToBytes(secret); + var secret_totp = new Totp(secret_bytes); + return secret_totp.VerifyTotp(totp, out _, VerificationWindow.RfcSpecifiedNetworkDelay); } + + /// + /// + /// + /// + /// + /// + public static string Join(this IEnumerable values, string seperator) => string.Join(seperator, values); } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs b/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs index 25b55bc7..5a97ef03 100644 --- a/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs +++ b/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs @@ -111,7 +111,7 @@ public abstract class SendMailHandler : INotificationHandler : INotificationHandler - encoded = encoded.Replace("\r\n", "
"); // Windows - encoded = encoded.Replace("\r", "
"); // Mac old - encoded = encoded.Replace("\n", "
"); // Unix/Linux - - return encoded; - } } \ No newline at end of file diff --git a/EnvelopeGenerator.Tests.Application/DocSignedNotificationTests.cs b/EnvelopeGenerator.Tests.Application/DocSignedNotificationTests.cs index 790aa445..2f11136e 100644 --- a/EnvelopeGenerator.Tests.Application/DocSignedNotificationTests.cs +++ b/EnvelopeGenerator.Tests.Application/DocSignedNotificationTests.cs @@ -18,7 +18,7 @@ public class DocSignedNotificationTests : TestBase services.AddTransient(); // overwrite EmailOutRepository - services.AddDbRepository(opt => opt.RegisterEntity(ctx => ctx.EMailOuts)) + services.AddDbRepository(opt => opt.RegisterEntity(ctx => ctx.EMailOuts)); } public override async Task Setup() diff --git a/EnvelopeGenerator.Tests.Application/Fake.cs b/EnvelopeGenerator.Tests.Application/Fake.cs index 04c62192..4d7bf681 100644 --- a/EnvelopeGenerator.Tests.Application/Fake.cs +++ b/EnvelopeGenerator.Tests.Application/Fake.cs @@ -20,6 +20,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using QuestPDF.Fluent; using QuestPDF.Infrastructure; +using EnvelopeGenerator.Application.Common.Extensions; namespace EnvelopeGenerator.Tests.Application; @@ -174,7 +175,7 @@ public static class Extensions public static CreateEnvelopeCommand CreateEnvelopeCommand(this Faker fake, int userId) => new() { Message = fake.Lorem.Paragraph(fake.Random.Number(2, 5)), - Title = fake.Lorem.Paragraph(fake.Random.Number(1, 2)), + Title = fake.Lorem.Words(fake.Random.Number(3, 4)).Join(" "), UserId = userId, UseSQLExecutor = false };