blob: 376c1092c56b07d83c822c0368febba15b5bf628 (
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.DeleteUser("admin")).Should().ThrowAsync<InvalidOperationOnRootUserException>();
}
}
}
|