blob: 10014d2bd17ec7cd40a9590f59a8de328ddc5629 (
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;
using Timeline.Services.Exceptions;
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>();
        }
    }
}
 |