测试覆盖率
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:
36
WebApi.Test/Repository/TransactionTestBase.cs
Normal file
36
WebApi.Test/Repository/TransactionTestBase.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace WebApi.Test.Repository;
|
||||
|
||||
public class TransactionTestBase : RepositoryTestBase
|
||||
{
|
||||
protected TransactionRecord CreateTestRecord(
|
||||
decimal amount,
|
||||
TransactionType type = TransactionType.Expense,
|
||||
DateTime? occurredAt = null,
|
||||
string reason = "测试摘要",
|
||||
string classify = "测试分类")
|
||||
{
|
||||
return new TransactionRecord
|
||||
{
|
||||
Amount = amount,
|
||||
Type = type,
|
||||
OccurredAt = occurredAt ?? DateTime.Now,
|
||||
Reason = reason,
|
||||
Classify = classify,
|
||||
Card = "1234",
|
||||
Balance = 1000,
|
||||
EmailMessageId = 1,
|
||||
ImportNo = Guid.NewGuid().ToString(),
|
||||
ImportFrom = "测试"
|
||||
};
|
||||
}
|
||||
|
||||
protected TransactionRecord CreateExpense(decimal amount, DateTime? occurredAt = null, string reason = "支出", string classify = "餐饮")
|
||||
{
|
||||
return CreateTestRecord(-amount, TransactionType.Expense, occurredAt, reason, classify);
|
||||
}
|
||||
|
||||
protected TransactionRecord CreateIncome(decimal amount, DateTime? occurredAt = null, string reason = "收入", string classify = "工资")
|
||||
{
|
||||
return CreateTestRecord(amount, TransactionType.Income, occurredAt, reason, classify);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user