<commit_before>﻿// ==========================================================================
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex UG (haftungsbeschraenkt)
//  All rights reserved. Licensed under the MIT license.
// ==========================================================================

using System;
using System.Threading;
using System.Threading.Tasks;
using FakeItEasy;
using Microsoft.Extensions.Options;
using Squidex.Domain.Apps.Core;
using Squidex.Domain.Apps.Core.TestHelpers;
using Squidex.Infrastructure.Email;
using Squidex.Log;
using Squidex.Shared.Users;
using Xunit;

namespace Squidex.Domain.Apps.Entities.Notifications
{
    public class NotificationEmailSenderTests
    {
        private readonly IEmailSender emailSender = A.Fake<IEmailSender>();
        private readonly IUrlGenerator urlGenerator = A.Fake<IUrlGenerator>();
        private readonly IUser assigner = UserMocks.User("1", "<EMAIL>", "user1");
        private readonly IUser assigned = UserMocks.User("2", "<EMAIL>", "user2");
        private readonly ISemanticLog log = A.Fake<ISemanticLog>();
        private readonly string appName = "my-app";
        private readonly string uiUrl = "my-ui";
        private readonly NotificationEmailTextOptions texts = new NotificationEmailTextOptions();
        private readonly NotificationEmailSender sut;

        public NotificationEmailSenderTests()
        {
            A.CallTo(() => urlGenerator.UI())
                .Returns(uiUrl);

            sut = new NotificationEmailSender(Options.Create(texts), emailSender, urlGenerator, log);
        }

        [Fact]
        public async Task Should_format_assigner_email_and_send_email()
        {
            await TestInvitationFormattingAsync("Email: $ASSIGNER_EMAIL", "Email: <EMAIL>");
        }

        [Fact]
        public async Task Should_format_assigner_name_and_send_email()
        {
            await TestInvitationFormattingAsync("Name: $ASSIGNER_NAME", "Name: user1");<commit_msg>Just a change.<commit_after>﻿// ==========================================================================
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex UG (haftungsbeschraenkt)
//  All rights reserved. Licensed under the MIT license.
// ==========================================================================

using System;
using System.Threading;
using System.Threading.Tasks;
using FakeItEasy;
using Microsoft.Extensions.Options;
using Squidex.Domain.Apps.Core;
using Squidex.Domain.Apps.Core.TestHelpers;
using Squidex.Infrastructure.Email;
using Squidex.Log;
using Squidex.Shared.Users;
using Xunit;

namespace Squidex.Domain.Apps.Entities.Notifications
{
    public class NotificationEmailSenderTests
    {
        private readonly IEmailSender emailSender = A.Fake<IEmailSender>();
        private readonly IUrlGenerator urlGenerator = A.Fake<IUrlGenerator>();
        private readonly IUser assigner = UserMocks.User("1", "<EMAIL>", "user1");
        private readonly IUser assigned = UserMocks.User("2", "<EMAIL>", "user2");
        private readonly ISemanticLog log = A.Fake<ISemanticLog>();
        private readonly string appName = "my-app";
        private readonly string appUI = "my-ui";
        private readonly NotificationEmailTextOptions texts = new NotificationEmailTextOptions();
        private readonly NotificationEmailSender sut;

        public NotificationEmailSenderTests()
        {
            A.CallTo(() => urlGenerator.UI())
                .Returns(appUI);

            sut = new NotificationEmailSender(Options.Create(texts), emailSender, urlGenerator, log);
        }

        [Fact]
        public async Task Should_format_assigner_email_and_send_email()
        {
            await TestInvitationFormattingAsync("Email: $ASSIGNER_EMAIL", "Email: <EMAIL>");
        }

        [Fact]
        public async Task Should_format_assigner_name_and_send_email()
        {
            await TestInvitationFormattingAsync("Name: $ASSIGNER_NAME", "Name: user1");
{'fraction_non_alphanumeric': 0.19643287539166063, 'fraction_numerical': 0.002410219329959026, 'mean_word_length': 3.836829836829837, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6445038', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1048, 'n_words': 249}