forked from ddrilling/AsbCloudServer
Доработка юнит-тестов
This commit is contained in:
parent
ada5dc28aa
commit
1aeb9599d1
@ -32,7 +32,7 @@ namespace AsbCloudInfrastructure.Background.PeriodicWorks
|
||||
var dataSaubStatService = services.GetService<IDataSaubStatService>();
|
||||
|
||||
if (dataSaubStatService != null )
|
||||
var createdDataSaubStatCount = await dataSaubStatService.CreateStatAsync(Gap, onProgressCallback, token);
|
||||
await dataSaubStatService.CreateStatAsync(Gap, onProgressCallback, token);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -244,16 +244,24 @@ public class DataSaubStatServiceTest
|
||||
.InsertRangeAsync(Arg.Any<IEnumerable<DataSaubStatDto>>(), Arg.Any<CancellationToken>())
|
||||
.Returns(insertedDataSaubStatCount);
|
||||
|
||||
Action<string, double?> action = (message, count) =>
|
||||
Action<string, double?> action = (message, percent) =>
|
||||
{
|
||||
//assert
|
||||
Assert.Equal(insertedDataSaubStatCount, count);
|
||||
Assert.NotNull(percent);
|
||||
Assert.InRange((double)percent, 0.0, 100.0);
|
||||
};
|
||||
|
||||
//act
|
||||
await dataSaubStatService.CreateStatAsync(Gap, action, CancellationToken.None);
|
||||
|
||||
//assert
|
||||
await dataSaubStatRepositoryMock.Received().InsertRangeAsync(
|
||||
Arg.Is<IEnumerable<DataSaubStatDto>>(l => l.Count() == insertedDataSaubStatCount),
|
||||
Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Create_2DataSaubStatItems_ShouldReturn__Success()
|
||||
{
|
||||
@ -297,13 +305,19 @@ public class DataSaubStatServiceTest
|
||||
.InsertRangeAsync(Arg.Any<IEnumerable<DataSaubStatDto>>(), Arg.Any<CancellationToken>())
|
||||
.Returns(insertedDataSaubStatCount);
|
||||
|
||||
Action<string, double?> action = (message, count) =>
|
||||
Action<string, double?> action = (message, percent) =>
|
||||
{
|
||||
//assert
|
||||
Assert.Equal(insertedDataSaubStatCount, count);
|
||||
Assert.NotNull(percent);
|
||||
Assert.InRange((double)percent, 0.0, 100.0);
|
||||
};
|
||||
|
||||
//act
|
||||
await dataSaubStatService.CreateStatAsync(Gap, action, CancellationToken.None);
|
||||
|
||||
//assert
|
||||
await dataSaubStatRepositoryMock.Received().InsertRangeAsync(
|
||||
Arg.Is<IEnumerable<DataSaubStatDto>>(l => l.Count() == insertedDataSaubStatCount),
|
||||
Arg.Any<CancellationToken>());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user