26 lines
782 B
C#
26 lines
782 B
C#
using System;
|
|
using HeartBeatServer.Models;
|
|
using HeartBeatServer.Services;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Xunit;
|
|
|
|
namespace HeartBeatServer.Tests.Services
|
|
{
|
|
public class EmailGeneratorServiceTests
|
|
{
|
|
[Fact]
|
|
public void SendEmail_ShouldThrow_WhenMissingSmtpSettings()
|
|
{
|
|
// Arrange
|
|
var configuration = new ConfigurationBuilder().Build();
|
|
var emailService = new EmailGeneratorService(configuration);
|
|
|
|
var email = new EmailModel();
|
|
|
|
// Act & Assert
|
|
Assert.Throws<ArgumentException>(() => emailService.SendEmailAsync(email).ConfigureAwait(false).GetAwaiter().GetResult());
|
|
// Expected to fail int.Parse on Port or missing required data
|
|
}
|
|
}
|
|
}
|