feat: remove V1 calendar/budget/stats modules
- 删除 V1 前端页面 (CalendarView, BudgetView, statisticsV1) - 移除 V1 路由配置 (/calendar, /budget, /) - 清理路由守卫中的 V1 版本切换逻辑 - 移除设置页面中的版本切换功能 - 更新底部导航和登录重定向到 V2 路由 - 移除 App.vue 中 V1 页面的缓存配置 - 删除后端 TransactionRecordController.GetDailyStatisticsAsync (Obsolete) - 删除 TransactionStatisticsController.GetBalanceStatisticsAsync - 保留 V2 仍在使用的共享 API (GetUncoveredCategories, GetArchiveSummary, GetDailyStatistics) - 保留 V2 使用的全局事件监听机制 - 所有测试通过 (210/210) Breaking Change: V1 API 端点和路由将不可用
This commit is contained in:
@@ -19,57 +19,6 @@ public class TransactionStatisticsApplicationTest : BaseApplicationTest
|
||||
_application = new TransactionStatisticsApplication(_statisticsService, _configService);
|
||||
}
|
||||
|
||||
#region GetBalanceStatisticsAsync Tests
|
||||
|
||||
[Fact]
|
||||
public async Task GetBalanceStatisticsAsync_有效数据_应返回累计余额统计()
|
||||
{
|
||||
// Arrange
|
||||
var year = 2026;
|
||||
var month = 2;
|
||||
var savingClassify = "储蓄";
|
||||
var dailyStats = new Dictionary<string, (int count, decimal expense, decimal income, decimal saving)>
|
||||
{
|
||||
{ "2026-02-01", (2, 500m, 1000m, 0m) },
|
||||
{ "2026-02-02", (1, 200m, 0m, 0m) },
|
||||
{ "2026-02-03", (2, 300m, 2000m, 0m) }
|
||||
};
|
||||
|
||||
_configService.GetConfigByKeyAsync<string>("SavingsCategories").Returns(savingClassify);
|
||||
_statisticsService.GetDailyStatisticsAsync(year, month, savingClassify).Returns(dailyStats);
|
||||
|
||||
// Act
|
||||
var result = await _application.GetBalanceStatisticsAsync(year, month);
|
||||
|
||||
// Assert
|
||||
result.Should().HaveCount(3);
|
||||
result[0].Day.Should().Be(1);
|
||||
result[0].CumulativeBalance.Should().Be(500m); // 1000 - 500
|
||||
result[1].Day.Should().Be(2);
|
||||
result[1].CumulativeBalance.Should().Be(300m); // 500 + (0 - 200)
|
||||
result[2].Day.Should().Be(3);
|
||||
result[2].CumulativeBalance.Should().Be(2000m); // 300 + (2000 - 300)
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetBalanceStatisticsAsync_无数据_应返回空列表()
|
||||
{
|
||||
// Arrange
|
||||
var year = 2026;
|
||||
var month = 2;
|
||||
_configService.GetConfigByKeyAsync<string>("SavingsCategories").Returns("储蓄");
|
||||
_statisticsService.GetDailyStatisticsAsync(year, month, "储蓄")
|
||||
.Returns(new Dictionary<string, (int, decimal, decimal, decimal)>());
|
||||
|
||||
// Act
|
||||
var result = await _application.GetBalanceStatisticsAsync(year, month);
|
||||
|
||||
// Assert
|
||||
result.Should().BeEmpty();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDailyStatisticsAsync Tests
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user