Files
2026-04-20 14:47:24 -05:00

95 lines
3.2 KiB
C#

using System;
using System.Collections.Generic;
using LCU.API.Collections.RepoApi.Domain.AlertChecker;
using LCU.API.Collections.RepoApi.Domain.Processing;
using LCU.Shared.Collections.RepoApiLib.Models;
using LCU.Shared.Collections.RepoApiLib.Models.Consumer;
using Xunit;
namespace LCU.API.Collections.RepoApiTests.AlertCheckers
{
public class DebitAdjustmentCheckerTest
{
private readonly DebitAdjustmentChecker _debitAdjustmentChecker;
private readonly List<CoreTransaction> _transactions;
public DebitAdjustmentCheckerTest()
{
_transactions = new List<CoreTransaction>()
{
new CoreTransaction()
{
postingDate = DateTime.Now.AddDays(-2),
transactionTypeCode = "PRCT",
amount = 500,
runningBalance = 2000,
transactionTypeDescription = "Test"
}
};
_debitAdjustmentChecker = new DebitAdjustmentChecker();
}
[Fact]
public void Creates_Alert_With_Recent_Transactions_Present_And_O4R_Status()
{
var slip = new RepoAccountProcessingSlip()
{
TransactionHistory = _transactions,
ExistingRepoAccount = new RepoAccount(),
UpdatedRepoAccount = new RepoAccount { Status = "O4R" }
};
var result = _debitAdjustmentChecker.CheckForAlert(slip);
Assert.NotNull(result);
Assert.Equal("Debit Adjustment Received", result[0].Message);
}
[Fact]
public void Creates_Alert_With_Recent_Transactions_Present_And_REPO_Status()
{
var slip = new RepoAccountProcessingSlip()
{
TransactionHistory = _transactions,
ExistingRepoAccount = new RepoAccount(),
UpdatedRepoAccount = new RepoAccount { Status = "REPO" }
};
var result = _debitAdjustmentChecker.CheckForAlert(slip);
Assert.NotNull(result);
Assert.Equal("Debit Adjustment Received", result[0].Message);
}
[Fact]
public void Creates_Alert_With_Recent_Transactions_Present_And_SOLD_Status()
{
var slip = new RepoAccountProcessingSlip()
{
TransactionHistory = _transactions,
ExistingRepoAccount = new RepoAccount(),
UpdatedRepoAccount = new RepoAccount { Status = "SOLD" }
};
var result = _debitAdjustmentChecker.CheckForAlert(slip);
Assert.NotNull(result);
Assert.Equal("Debit Adjustment Received", result[0].Message);
}
[Fact]
public void Does_Not_Create_Alert_For_Unwatched_Statuses()
{
var slip = new RepoAccountProcessingSlip()
{
TransactionHistory = _transactions,
ExistingRepoAccount = new RepoAccount(),
UpdatedRepoAccount = new RepoAccount { Status = "RECA" }
};
var result = _debitAdjustmentChecker.CheckForAlert(slip);
Assert.Null(result);
}
}
}