Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
1.3 KiB

// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Squidex.Infrastructure.TestHelpers;
using Xunit;
namespace Squidex.Infrastructure.Email
{
[Trait("Category", "Dependencies")]
public class SmtpEmailSenderTests
{
[Fact]
public async Task Should_handle_timeout_properly()
{
var options = TestConfig.Configuration.GetSection("email:smtp").Get<SmtpOptions>();
var recipient = TestConfig.Configuration["email:smtp:recipient"];
var testSubject = TestConfig.Configuration["email:smtp:testSubject"];
var testBody = TestConfig.Configuration["email:smtp:testBody"];
var sut = new SmtpEmailSender(Options.Create(options));
using (var cts = new CancellationTokenSource(5000))
{
await sut.SendAsync(recipient, testSubject, testBody, cts.Token);
}
}
}
}