-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServiceTests.cs
40 lines (34 loc) · 975 Bytes
/
ServiceTests.cs
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
28
29
30
31
32
33
34
35
36
37
38
39
40
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace Dapper.Issue2117.Test;
[TestFixture]
public class ParentServiceTests: SetupBase
{
private IHost _host;
private static IParentService _service;
[OneTimeSetUp]
public void OneTimeSetup()
{
_host = base.OneTimeSetup();
}
[OneTimeTearDown]
public void OneTimeTearDown()
{
_host.Dispose();
}
[SetUp]
public void Setup()
{
using var scope = _host.Services.CreateScope();
_service = scope.ServiceProvider.GetRequiredService<IParentService>();
}
[Test]
public async Task TestUpdateOneAsync()
{
var token = new CancellationToken();
var entity = (await _service.GetAsync(token, commit: false).ConfigureAwait(false))
.Where(k => k.Children.Any()).First();
var result = await _service.UpdateAsync(entity, token, commit: false).ConfigureAwait(false);
Assert.That(result!.GetType() == typeof(ParentEntity));
}
}