测试覆盖率
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 27s
Docker Build & Deploy / Deploy to Production (push) Successful in 9s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 27s
Docker Build & Deploy / Deploy to Production (push) Successful in 9s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
This commit is contained in:
@@ -16,14 +16,13 @@ public class BudgetStatsTest : BaseTest
|
||||
private readonly ILogger<BudgetService> _logger = Substitute.For<ILogger<BudgetService>>();
|
||||
private readonly IBudgetSavingsService _budgetSavingsService = Substitute.For<IBudgetSavingsService>();
|
||||
private readonly IDateTimeProvider _dateTimeProvider = Substitute.For<IDateTimeProvider>();
|
||||
private readonly IBudgetStatsService _budgetStatsService;
|
||||
private readonly BudgetService _service;
|
||||
|
||||
public BudgetStatsTest()
|
||||
{
|
||||
_dateTimeProvider.Now.Returns(new DateTime(2024, 1, 15));
|
||||
|
||||
_budgetStatsService = new BudgetStatsService(
|
||||
IBudgetStatsService budgetStatsService = new BudgetStatsService(
|
||||
_budgetRepository,
|
||||
_budgetArchiveRepository,
|
||||
_transactionStatisticsService,
|
||||
@@ -41,7 +40,7 @@ public class BudgetStatsTest : BaseTest
|
||||
_logger,
|
||||
_budgetSavingsService,
|
||||
_dateTimeProvider,
|
||||
_budgetStatsService
|
||||
budgetStatsService
|
||||
);
|
||||
}
|
||||
|
||||
@@ -124,8 +123,7 @@ public class BudgetStatsTest : BaseTest
|
||||
Arg.Is<DateTime>(d => d.Year == 2024 && d.Month == 1 && d.Day == 1),
|
||||
Arg.Is<DateTime>(d => d.Year == 2024 && d.Month == 1 && d.Day == 31),
|
||||
TransactionType.Expense,
|
||||
Arg.Is<List<string>>(list => list.Count == 1 && list.Contains("餐饮")), // 只包含月度预算的分类
|
||||
false)
|
||||
Arg.Is<List<string>>(list => list.Count == 1 && list.Contains("餐饮")))
|
||||
.Returns(new Dictionary<DateTime, decimal>
|
||||
{
|
||||
{ new DateTime(2024, 1, 15), 800m } // 1月15日月度吃饭累计800
|
||||
@@ -281,8 +279,7 @@ public class BudgetStatsTest : BaseTest
|
||||
Arg.Is<DateTime>(d => d.Year == 2024 && d.Month == 1),
|
||||
Arg.Is<DateTime>(d => d.Year == 2024 && d.Month == 1),
|
||||
TransactionType.Expense,
|
||||
Arg.Is<List<string>>(list => list.Count == 3 && list.Contains("餐饮") && list.Contains("零食") && list.Contains("交通")),
|
||||
false)
|
||||
Arg.Is<List<string>>(list => list.Count == 3 && list.Contains("餐饮") && list.Contains("零食") && list.Contains("交通")))
|
||||
.Returns(new Dictionary<DateTime, decimal>
|
||||
{
|
||||
{ new DateTime(2024, 1, 15), 1500m } // 1月15日累计1500(吃喝1200+交通300,不包含年度旅游2000)
|
||||
@@ -305,8 +302,7 @@ public class BudgetStatsTest : BaseTest
|
||||
Arg.Is<DateTime>(d => d.Year == 2024 && d.Month == 1),
|
||||
Arg.Is<DateTime>(d => d.Year == 2024 && d.Month == 1),
|
||||
TransactionType.Income,
|
||||
Arg.Any<List<string>>(),
|
||||
false)
|
||||
Arg.Any<List<string>>())
|
||||
.Returns(new Dictionary<DateTime, decimal>()); // 月度收入为空
|
||||
|
||||
_transactionStatisticsService.GetFilteredTrendStatisticsAsync(
|
||||
|
||||
Reference in New Issue
Block a user