From 1aeb9599d1f824cc745ebb8bae3c1bac2176767f Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 5 Aug 2024 10:20:48 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=8E=D0=BD=D0=B8=D1=82-=D1=82=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PeriodicWorks/WorkDataSaubStat.cs | 2 +- .../Services/DataSaubStatServiceTest.cs | 22 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) 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