Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

1.1 KB
Raw Blame
using Grand.Business.Core.Interfaces.Messages;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Business.Messages.Services;
using Grand.Domain.Messages;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System.Net.Sockets;

namespace Grand.Business.Messages.Tests.Services;

[TestClass]
public class EmailSenderTests
{
    private Mock<IDownloadService> _downloadService;
    private Mock<IMimeMappingService> _mimeMappingService;
    private EmailSender _sender;

    [TestInitialize]
    public void Init()
    {
        _downloadService = new Mock<IDownloadService>();
        _mimeMappingService = new Mock<IMimeMappingService>();

        _sender = new EmailSender(_downloadService.Object, _mimeMappingService.Object);
    }

    [TestMethod]
    public void SendEmailTest()
    {
        Assert.ThrowsExactlyAsync<SocketException>(async () =>
            await _sender.SendEmail(new EmailAccount { Host = "[email protected]" }, "subject", "body", "[email protected]",
                "admin store", "[email protected]", "Customer name"));
    }
}