diff --git a/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs index e63a4bd9..7cef92d4 100644 --- a/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs +++ b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs @@ -32,7 +32,7 @@ namespace AsbCloudInfrastructure.Background.PeriodicWorks var dataSaubStatService = services.GetService(); if (dataSaubStatService != null ) - var createdDataSaubStatCount = await dataSaubStatService.CreateStatAsync(Gap, onProgressCallback, token); + await dataSaubStatService.CreateStatAsync(Gap, onProgressCallback, token); } } diff --git a/AsbCloudWebApi.Tests/Services/DataSaubStatServiceTest.cs b/AsbCloudWebApi.Tests/Services/DataSaubStatServiceTest.cs index 5c70c411..ed03769e 100644 --- a/AsbCloudWebApi.Tests/Services/DataSaubStatServiceTest.cs +++ b/AsbCloudWebApi.Tests/Services/DataSaubStatServiceTest.cs @@ -244,16 +244,24 @@ public class DataSaubStatServiceTest .InsertRangeAsync(Arg.Any>(), Arg.Any()) .Returns(insertedDataSaubStatCount); - Action action = (message, count) => + Action 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>(l => l.Count() == insertedDataSaubStatCount), + Arg.Any()); } + + [Fact] public async Task Create_2DataSaubStatItems_ShouldReturn__Success() { @@ -297,13 +305,19 @@ public class DataSaubStatServiceTest .InsertRangeAsync(Arg.Any>(), Arg.Any()) .Returns(insertedDataSaubStatCount); - Action action = (message, count) => + Action 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>(l => l.Count() == insertedDataSaubStatCount), + Arg.Any()); } } \ No newline at end of file