blob: 17aea27b933fe96b7e0135afe9ff0abb063a5f71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
using FluentAssertions;
using Microsoft.Extensions.Logging.Abstractions;
using Moq;
using System.Threading.Tasks;
using Timeline.Services.Timeline;
using Timeline.Services.User;
using Xunit;
namespace Timeline.Tests.Services
{
public class UserDeleteServiceTest : ServiceTestBase
{
private readonly Mock<ITimelinePostService> _mockTimelinePostService = new Mock<ITimelinePostService>();
private UserDeleteService _service = default!;
protected override void OnInitialize()
{
_service = new UserDeleteService(NullLogger<UserDeleteService>.Instance, Database, _mockTimelinePostService.Object);
}
[Fact]
public async Task DeleteRootUser_Should_Throw()
{
await _service.Awaiting(s => s.DeleteUserAsync("admin")).Should().ThrowAsync<InvalidOperationOnRootUserException>();
}
}
}
|