forked from ddrilling/AsbCloudServer
Fix EmailNotificationTransportServiceTests
This commit is contained in:
parent
67481a7743
commit
c2f69463d2
@ -2,9 +2,7 @@
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services.Notifications;
|
||||
using AsbCloudInfrastructure.Background;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
@ -62,17 +62,11 @@ namespace AsbCloudWebApi.Tests.UnitTests.Services.Notification
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SendAsync()
|
||||
public async Task SendAsyncThrowsMailboxUnavailable()
|
||||
{
|
||||
userRepository.GetOrDefaultAsync(Arg.Any<int>(), Arg.Any<CancellationToken>()).Returns(user);
|
||||
try
|
||||
{
|
||||
await notificationTransportService.SendAsync(notification, CancellationToken.None);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Assert.True(e is SmtpException);
|
||||
}
|
||||
var exception = await Assert.ThrowsAsync<SmtpException>(() => notificationTransportService.SendAsync(notification, CancellationToken.None));
|
||||
Assert.Equal(SmtpStatusCode.MailboxUnavailable, exception.StatusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user