using System.Collections.Generic; using LCU.API.Collections.CollectionsApiLib.Models; 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 RtcLetterIsNullCheckerTest { public RtcLetterIsNullCheckerTest() { } private MemberDetail MakeMemberWithAddressInState(string state) { return new MemberDetail { Address = new AddressDetail { State = state } }; } [Fact] public void Create_RtcLetterWiAutoLoansFound_Ok() { var slip = new RepoAccountProcessingSlip() { Letters = new List { new RepoLetter { ActionCode = "RTC 3", NoticeType = "RTC-WI-AUTO LOANS" } }, Member = MakeMemberWithAddressInState("WI"), ExistingRepoAccount = new RepoAccount() { AccountNo = "123456-789", Status = "RECA" }, UpdatedRepoAccount = new RepoAccount() { AccountNo = "123456-789", Status = "RECA", Collaterals = new List { new Collateral { CollateralId = 1 } } } }; var checker = new RtcLetterNotFoundChecker("RTC Letter", new List { "RTC 1", "RTC 3" }); var result = checker.CheckForAlert(slip); Assert.Null(result); } [Fact] public void Create_RtcLetterWiNonAutoFound_Ok() { var slip = new RepoAccountProcessingSlip() { Letters = new List { new RepoLetter { ActionCode = "RTC 1", NoticeType = "RTC WI- ATV,Boat, Snowmobile" } }, Member = MakeMemberWithAddressInState("WI"), ExistingRepoAccount = new RepoAccount() { AccountNo = "123456-789", Status = "RECA" }, UpdatedRepoAccount = new RepoAccount() { AccountNo = "123456-789", Status = "RECA", Collaterals = new List { new Collateral { CollateralId = 1 } } } }; var checker = new RtcLetterNotFoundChecker("RTC Letter", new List { "RTC 1", "RTC 3" }); var result = checker.CheckForAlert(slip); Assert.Null(result); } [Fact] public void Create_RtcLetterIlNotApplicable_Ok() { var slip = new RepoAccountProcessingSlip() { Letters = new List(), Member = MakeMemberWithAddressInState("IL"), ExistingRepoAccount = new RepoAccount() { AccountNo = "123456-789", Status = "RECA" }, UpdatedRepoAccount = new RepoAccount() { AccountNo = "123456-789", Status = "RECA", Collaterals = new List { new Collateral { CollateralId = 1 } } } }; var checker = new RtcLetterNotFoundChecker("RTC Letter", new List { "RTC 1", "RTC 3" }); var result = checker.CheckForAlert(slip); Assert.Null(result); } [Fact] public void Create_RtcLetterWiVoluntary_Ok() { var slip = new RepoAccountProcessingSlip() { Letters = new List(), Member = MakeMemberWithAddressInState("WI"), ExistingRepoAccount = new RepoAccount() { AccountNo = "123456-789", Status = "RECA", Collaterals = new List { new Collateral { CollateralId = 1, RepoCompanySelections = new List { new RepoCompanySelection { Id = 1, RepoType = RepoType.Voluntary } } } } }, UpdatedRepoAccount = new RepoAccount() { AccountNo = "123456-789", Status = "RECA", Collaterals = new List { new Collateral { CollateralId = 1, RepoCompanySelections = new List { new RepoCompanySelection { Id = 1, RepoType = RepoType.Voluntary } } } } } }; var checker = new RtcLetterNotFoundChecker("RTC Letter", new List { "RTC 1", "RTC 3" }); var result = checker.CheckForAlert(slip); Assert.Null(result); } [Fact] public void Create_RtcLetterNotFound_Ok() { var slip = new RepoAccountProcessingSlip() { Letters = new List(), Member = MakeMemberWithAddressInState("WI"), ExistingRepoAccount = new RepoAccount() { RepoId = 5, AccountNo = "123456-789", Status = "RECA" }, UpdatedRepoAccount = new RepoAccount() { RepoId = 5, AccountNo = "123456-789", Status = "RECA", Collaterals = new List { new Collateral { CollateralId = 1 } } } }; var checker = new RtcLetterNotFoundChecker("RTC Letter", new List { "RTC 1", "RTC 3" }); var result = checker.CheckForAlert(slip); Assert.Null(result); } } }