This commit is contained in:
Zeeshaun
2026-03-17 09:53:09 -05:00
parent cdcba54aa4
commit 1a0702a79a
590 changed files with 62058 additions and 0 deletions
@@ -0,0 +1,65 @@
using System;
using LCU.API.Internal.Operations.IncentiveApi.Models;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using System.Collections.Generic;
using NUnit.Framework;
namespace Application.UnitTests.Models
{
public class DepartmentGoalsTest
{
[Test]
public void ApplyGoals_Basic()
{
var goals = new List<Goal>()
{
new Goal()
{
Product = Product.Vehicle,
DepartmentId = 55,
Value = 1,
StartDate = DateTime.Today
},
new Goal()
{
Product = Product.CheckCard,
DepartmentId = 55,
Value = 34,
StartDate = DateTime.Today
}
};
var user = new AppUser()
{
AdEmail = "[email protected]",
BaseRole = "Tester",
EmployeeId = "11771",
FullName = "Test McTester",
HomeDepartment = "HOME",
PersonId = 565,
Departments = new List<UserDepartment>()
{
new UserDepartment()
{
DepartmentId = 55,
Role = Role.Admin
}
}
};
var users = new List<AppUser>()
{
user
};
var departmentGoals = new DepartmentGoals(55, DateTime.Now.Year);
Assert.NotNull(departmentGoals.MonthlyGoals);
Assert.AreEqual(12, departmentGoals.MonthlyGoals.Length);
Assert.AreEqual(0,departmentGoals.MonthlyGoals[DateTime.Today.Month-1].ProductGoals[Product.Vehicle] );
Assert.AreEqual(0,departmentGoals.MonthlyGoals[DateTime.Today.Month-1].ProductGoals[Product.CheckCard] );
departmentGoals.ApplyAll(goals);
Assert.AreEqual(1,departmentGoals.MonthlyGoals[DateTime.Today.Month-1].ProductGoals[Product.Vehicle] );
Assert.AreEqual(34,departmentGoals.MonthlyGoals[DateTime.Today.Month-1].ProductGoals[Product.CheckCard] );
}
}
}
@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using LCU.API.Internal.Operations.IncentiveApi.Models;
using LCU.Library.Internal.IncentiveApiModels.Common;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using NUnit.Framework;
namespace Application.UnitTests.Models
{
public class EmployeeGoalTest
{
[Test]
public void ApplyGoals_Basic()
{
var goals = new List<Goal>()
{
new Goal()
{
Product = Product.Vehicle,
DepartmentId = 55,
EmployeeId = "11771",
Value = 1
},
new Goal()
{
Product = Product.CheckCard,
DepartmentId = 55,
EmployeeId = "11771",
Value = 34
},
// This user shouldn't have this goal, but they do...
new Goal()
{
Product = Product.CheckCard,
DepartmentId = 56,
EmployeeId = "11771",
Value = 44
},
};
var user = new AppUser()
{
Role = Role.Admin,
AdEmail = "[email protected]",
BaseRole = "Tester",
EmployeeId = "11771",
FullName = "Test McTester",
HomeDepartment = "HOME",
PersonId = 565,
Departments = new List<UserDepartment>()
{
new UserDepartment()
{
DepartmentId = 55
}
}
};
var range = new MonthRange(2021,1,2021,2);
var employeeGoals = new EmployeeGoals(user, range);
Assert.NotNull(employeeGoals.Departments);
Assert.AreEqual(1, employeeGoals.Departments.Count);
Assert.AreEqual(0,employeeGoals.Goals[55].ProductGoals[Product.Vehicle]);
Assert.AreEqual(0,employeeGoals.Goals[55].ProductGoals[Product.CheckCard]);
employeeGoals.ApplyAll(goals);
Assert.AreEqual(1,employeeGoals.Goals[55].ProductGoals[Product.Vehicle]);
Assert.AreEqual(34,employeeGoals.Goals[55].ProductGoals[Product.CheckCard]);
}
[Test]
public void EmployeeGoals_CreatesGoalsForDepartmentsAssignedInRange()
{
var deparmentBeforeRange = new UserDepartment()
{
DepartmentId = 1,
StartDate = new DateTime(2020, 12, 1),
EndDate = new DateTime(2020, 12, 31)
};
var departmentAfterRange = new UserDepartment()
{
DepartmentId = 2,
StartDate = new DateTime(2021, 3, 1),
EndDate = new DateTime(2021, 3, 31)
};
var departmentInRange = new UserDepartment()
{
DepartmentId = 3,
StartDate = new DateTime(2021, 2, 1),
EndDate = new DateTime(2021, 2, 28)
};
var departmentCurrentlyAssigned = new UserDepartment()
{
DepartmentId = 4,
StartDate = new DateTime(2020, 1, 1),
EndDate = null
};
var user = new AppUser()
{
Role = Role.Admin,
AdEmail = "[email protected]",
BaseRole = "Tester",
EmployeeId = "11771",
FullName = "Test McTester",
HomeDepartment = "HOME",
PersonId = 565,
Departments = new List<UserDepartment>()
{
deparmentBeforeRange,
departmentAfterRange,
departmentCurrentlyAssigned,
departmentInRange
}
};
var range = new MonthRange(2021,1,2021,2);
var employeeGoals = new EmployeeGoals(user, range);
Assert.AreEqual(2, employeeGoals.Departments.Count);
Assert.IsFalse(employeeGoals.Departments.Contains(deparmentBeforeRange));
Assert.IsFalse(employeeGoals.Departments.Contains(departmentAfterRange));
Assert.IsTrue(employeeGoals.Departments.Contains(departmentInRange));
Assert.IsTrue(employeeGoals.Departments.Contains(departmentCurrentlyAssigned));
}
}
}
@@ -0,0 +1,313 @@
using System;
using System.Collections.Generic;
using LCU.API.Internal.Operations.IncentiveApi.Models;
using LCU.Library.Internal.IncentiveApiModels.Common;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using NUnit.Framework;
namespace Application.UnitTests.Models
{
public class EmployeeProgressTest
{
[Test]
public void ApplyProgress_Basic()
{
var activity = new List<Activity>()
{
new Activity()
{
Id = 5,
Product = Product.Mortgage,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale,
Detail = new ActivityDetail()
{
AccountBalance = 5100.25
}
},
new Activity()
{
Id = 5,
Product = Product.Vehicle,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale,
Detail = new ActivityDetail()
{
IsDebtProtectionEligible = true,
DebtProtectionAddDate = DateTime.Today,
AccountBalance = 5100.25
}
},
new Activity()
{
Id = 6,
Product = Product.Mortgage,
State = ActivityState.Rejected,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale,
Detail = new ActivityDetail()
{
AccountBalance = 7100.75
}
},
new Activity()
{
Id = 55,
Product = Product.CheckCard,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale
},
new Activity()
{
Id = 56,
Product = Product.CheckCard,
State = ActivityState.Transferred,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale
},
new Activity()
{
Id = 57,
Product = Product.ATMCard,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale
}
};
var user = new AppUser()
{
AdEmail = "[email protected]",
BaseRole = "Tester",
EmployeeId = "11771",
FullName = "Test McTester",
HomeDepartment = "HOME",
PersonId = 565,
Departments = new List<UserDepartment>()
{
new UserDepartment()
{
DepartmentId = 55,
Role = Role.Admin
}
}
};
var range = new MonthRange(2021, 1, 2021, 2);
var employeeProgress = new EmployeeProgress(user, range, new List<IPayoutRule>());
Assert.NotNull(employeeProgress.Departments);
Assert.AreEqual(1, employeeProgress.Departments.Count);
Assert.AreEqual(0, employeeProgress.Progress[55].ProductActivity[Product.Mortgage]);
Assert.AreEqual(0, employeeProgress.Progress[55].ProductActivity[Product.CheckCard]);
employeeProgress.ApplyAll(activity);
Assert.AreEqual(5100.25, employeeProgress.Progress[55].ProductActivity[Product.Mortgage]);
Assert.AreEqual(1, employeeProgress.Progress[55].ProductActivity[Product.CheckCard]);
}
[Test]
public void ApplyProgress_GAP_DP()
{
var activity = new List<Activity>()
{
new Activity()
{
Id = 2,
Product = Product.Mortgage,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale,
Detail = new ActivityDetail()
{
AccountBalance = 5100.25
}
},
new Activity()
{
Id = 2,
Product = Product.Vehicle,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale,
Detail = new ActivityDetail()
{
IsDebtProtectionEligible = true,
DebtProtectionAddDate = null,
AccountBalance = 5100.25
}
},
new Activity()
{
Id = 3,
Product = Product.DebtProtectionEligibleLoan,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale,
Detail = new ActivityDetail()
{
IsDebtProtectionEligible = true,
DebtProtectionAddDate = null,
AccountBalance = 5100.25
}
},
new Activity()
{
Id = 5,
Product = Product.Vehicle,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale,
Detail = new ActivityDetail()
{
IsDebtProtectionEligible = true,
DebtProtectionAddDate = DateTime.Today,
AccountBalance = 5100.25
}
},
new Activity()
{
Id = 6,
Product = Product.Mortgage,
State = ActivityState.Rejected,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale,
Detail = new ActivityDetail()
{
AccountBalance = 7100.75
}
},
new Activity()
{
Id = 55,
Product = Product.CheckCard,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale
},
new Activity()
{
Id = 56,
Product = Product.CheckCard,
State = ActivityState.Transferred,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale
},
new Activity()
{
Id = 57,
Product = Product.ATMCard,
State = ActivityState.Accepted,
EmployeeId = "11771",
DepartmentId = 55,
Type = ActivityType.Sale
}
};
var user = new AppUser()
{
AdEmail = "[email protected]",
BaseRole = "Tester",
EmployeeId = "11771",
FullName = "Test McTester",
HomeDepartment = "HOME",
PersonId = 565,
Departments = new List<UserDepartment>()
{
new UserDepartment()
{
DepartmentId = 55,
Role = Role.Admin
}
}
};
var range = new MonthRange(2021, 1, 2021, 2);
var employeeProgress = new EmployeeProgress(user, range, new List<IPayoutRule>());
Assert.NotNull(employeeProgress.Departments);
Assert.AreEqual(1, employeeProgress.Departments.Count);
Assert.AreEqual(0, employeeProgress.Progress[55].ProductActivity[Product.DebtProtectionEligibleLoan]);
employeeProgress.ApplyAll(activity);
Assert.AreEqual(1, employeeProgress.Progress[55].ProductActivity[Product.DebtProtectionEligibleLoan]);
Assert.AreEqual(3, employeeProgress.Progress[55].ProductOther[Product.DebtProtectionEligibleLoan]);
}
[Test]
public void EmployeeProgress_CreatesProgressForDepartmentsAssignedInRange()
{
var departmentBeforeRange = new UserDepartment()
{
DepartmentId = 1,
StartDate = new DateTime(2020, 12, 1),
EndDate = new DateTime(2020, 12, 31),
Role = Role.Admin
};
var departmentAfterRange = new UserDepartment()
{
DepartmentId = 2,
StartDate = new DateTime(2021, 3, 1),
EndDate = new DateTime(2021, 3, 31),
Role = Role.Admin
};
var departmentInRange = new UserDepartment()
{
DepartmentId = 3,
StartDate = new DateTime(2021, 2, 1),
EndDate = new DateTime(2021, 2, 28),
Role = Role.Admin
};
var departmentCurrentlyAssigned = new UserDepartment()
{
DepartmentId = 4,
StartDate = new DateTime(2020, 1, 1),
EndDate = null,
Role = Role.Admin
};
var user = new AppUser()
{
AdEmail = "[email protected]",
BaseRole = "Tester",
EmployeeId = "11771",
FullName = "Test McTester",
HomeDepartment = "HOME",
PersonId = 565,
Departments = new List<UserDepartment>()
{
departmentBeforeRange,
departmentAfterRange,
departmentCurrentlyAssigned,
departmentInRange
}
};
var range = new MonthRange(2021, 1, 2021, 2);
var employeeProgress = new EmployeeProgress(user, range, new List<IPayoutRule>());
Assert.AreEqual(2, employeeProgress.Departments.Count);
Assert.IsFalse(employeeProgress.Departments.Contains(departmentBeforeRange));
Assert.IsFalse(employeeProgress.Departments.Contains(departmentAfterRange));
Assert.IsTrue(employeeProgress.Departments.Contains(departmentInRange));
Assert.IsTrue(employeeProgress.Departments.Contains(departmentCurrentlyAssigned));
}
}
}
@@ -0,0 +1,151 @@
using System;
using LCU.API.Internal.Operations.IncentiveApi.Models.ExternalActivities;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using NUnit.Framework;
namespace Application.UnitTests.Models.ExternalActivity
{
public class ExternalActivityTests
{
private NewLoanSaleActivity externalActivity = new NewLoanSaleActivity();
[SetUp]
public void SetUp()
{
externalActivity.ActivityNbr = 100;
externalActivity.ActivityDateTime = DateTime.Parse("2021-09-28T21:32:38");
externalActivity.SubjectAccountNbr = 555;
externalActivity.OriginatingPersonNbr = 10;
externalActivity.ActivityTypeCode = "ADAC";
externalActivity.MajorAccountType = "CNS";
externalActivity.MinorAccountType = "DV01";
externalActivity.AssociateFirst = "Bruce";
externalActivity.AssociateMiddleInit = null;
externalActivity.AssociateLast = "Willis";
externalActivity.TaxPersonNbr = "1258";
externalActivity.TaxOrgNbr = null;
externalActivity.AccountContractDate = DateTime.Parse("2021-09-28T00:00:00");
externalActivity.CurrentAccountStatus = "ACT";
externalActivity.BranchOrgNbr = 1119;
externalActivity.BranchOrgName = "Oak Creek Branch";
externalActivity.EmployeeEmail = "[email protected]";
externalActivity.LoanSourceCode = "NEW";
externalActivity.LoanAmount = 23000;
externalActivity.DebtProtectionEffectiveDate = DateTime.Parse("2021-09-29T00:00:00");
externalActivity.YoungestBirthdateOnLoan = DateTime.Parse("1999-04-01T00:00:00");
externalActivity.HasOrgRoles = 0;
}
[TestCase("BE21", 0, null, false, false)]
[TestCase("DV01", 1, null, false, true)]
[TestCase("DV01", 0, "12345", false, true)]
[TestCase("DV02", 0, null, true, true)]
[TestCase("DV03", 0, null, true, true)]
[TestCase("DV04", 0, null, true, true)]
[TestCase("DV05", 0, null, true, true)]
[TestCase("DV06", 0, null, true, true)]
[TestCase("DV07", 0, null, true, true)]
[TestCase("DV08", 0, null, true, true)]
[TestCase("SC01", 0, null, true, false)]
[TestCase("SC02", 0, null, true, false)]
[TestCase("SG01", 0, null, true, false)]
[TestCase("NotReal", 0, null, false, true)]
[TestCase("FE01", 0, null, false, false)]
public void ExternalLoanSaleActivity_IsDebtProtectionEligible_OK(string minorAccountType, int hasOrgRoles, string taxOrgNbr,
bool result, bool isGap)
{
externalActivity.MinorAccountType = minorAccountType;
externalActivity.TaxOrgNbr = taxOrgNbr;
externalActivity.HasOrgRoles = hasOrgRoles;
var mapped = externalActivity.MapToActivity();
Assert.AreEqual(result, mapped.Detail.IsDebtProtectionEligible);
Assert.AreEqual(isGap, mapped.Detail.IsGapInsuranceEligible);
}
[TestCase("FE01", Product.Mortgage, false)]
[TestCase("FE02", Product.Mortgage, false)]
[TestCase("FLML", Product.Mortgage, false)]
[TestCase("MF01", Product.Mortgage, false)]
[TestCase("FNMA", Product.FirstMortgageReferral, false)]
[TestCase("fnma", Product.FirstMortgageReferral, false)]
[TestCase("FRML", Product.FirstMortgageReferral, false)]
[TestCase("frMl", Product.FirstMortgageReferral, false)]
[TestCase("mJ30", Product.FirstMortgageReferral, false)]
[TestCase("MJ30", Product.FirstMortgageReferral, false)]
[TestCase("DL01",Product.Vehicle, true)]
[TestCase("DV07",Product.Vehicle, true)]
[TestCase("DV08",Product.Vehicle, true)]
[TestCase("DL09",Product.Vehicle, true)]
[TestCase("DV02",Product.Vehicle, true)]
[TestCase("DV03",Product.Vehicle, true)]
[TestCase("DV04",Product.Vehicle, true)]
[TestCase("DV05",Product.Vehicle, true)]
[TestCase("DV06",Product.Vehicle, true)]
[TestCase("DL08",Product.Vehicle, true)]
[TestCase("DV01",Product.Vehicle, true)]
[TestCase("DL13",Product.Vehicle, true)]
[TestCase("DL14",Product.Vehicle, true)]
[TestCase("DL16",Product.Vehicle, true)]
[TestCase("DL10",Product.Vehicle, true)]
[TestCase("DL12",Product.Vehicle, true)]
[TestCase("DL11",Product.Vehicle, true)]
[TestCase("DL07",Product.Vehicle, true)]
[TestCase("DL06",Product.Vehicle, true)]
[TestCase("SC01",Product.DebtProtectionEligibleLoan, false)]
[TestCase("SC02",Product.DebtProtectionEligibleLoan, false)]
[TestCase("SG01",Product.DebtProtectionEligibleLoan, false)]
public void NewLoanActivity_MapActivity_Product(string minorAccountType, Product expectedProduct, bool isGap)
{
externalActivity.MinorAccountType = minorAccountType;
var mapped = externalActivity.MapToActivity();
Assert.AreEqual(expectedProduct, mapped.Product);
Assert.AreEqual(isGap, externalActivity.IsGapInsuranceEligible());
}
[TestCase("CC Balance Transfer", Product.CreditCardBalanceTransfer, 0)]
[TestCase("ATM Card", Product.ATMCard, 0)]
[TestCase("Check Card Referral", Product.CheckCard, 0)]
[TestCase("Checking Referral", Product.NewChecking, 0)]
[TestCase("Mortgage Referral", Product.Mortgage, 0)]
[TestCase("Direct Deposit", Product.DirectDeposit, 0)]
[TestCase("LIC Referral", Product.LIC, 1)]
[TestCase("First Mortgage Referral", Product.FirstMortgageReferral, 0)]
[TestCase("eStatement Referral", Product.eStatement, 0)]
public void NewActivityManagerReferral_MapActivity_Product(string campaign, Product expectedProduct, int isFinalStation)
{
var amr = new NewActivityManagerReferral();
amr.Campaign = campaign;
amr.IsFinalStation = isFinalStation;
var mapped = amr.MapToActivity();
Assert.AreEqual(expectedProduct, mapped.Product);
}
[TestCase("ATM", Product.ATMCard)]
[TestCase("DB01", Product.CheckCard)]
public void NewCardSaleActivity_MapActivity_Product(string cardType, Product expectedProduct)
{
var amr = new NewAtmCheckCardActivity();
amr.CardType = cardType;
var mapped = amr.MapToActivity();
Assert.AreEqual(expectedProduct, mapped.Product);
}
[Test]
public void ExternalLoanSaleActivity_IsDebtProtectionEligible_AgeCalc_OK()
{
externalActivity.YoungestBirthdateOnLoan = DateTime.Now.AddYears(-70).AddDays(-1);
var mapped = externalActivity.MapToActivity();
Assert.AreEqual(false, mapped.Detail.IsDebtProtectionEligible);
externalActivity.YoungestBirthdateOnLoan = DateTime.Now.AddYears(-68).AddDays(-1);
mapped = externalActivity.MapToActivity();
Assert.AreEqual(true, mapped.Detail.IsDebtProtectionEligible);
externalActivity.YoungestBirthdateOnLoan = DateTime.Now.AddYears(-22).AddDays(-1);
mapped = externalActivity.MapToActivity();
Assert.AreEqual(true, mapped.Detail.IsDebtProtectionEligible);
}
}
}
@@ -0,0 +1,31 @@
using System;
using System.Linq;
using LCU.API.Internal.Operations.IncentiveApi.Models.GoalDispersal;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using NUnit.Framework;
namespace Application.UnitTests.Models
{
public class GoalDispersalReceiptTest
{
[Test]
public void GoalDispersalReceiptItem_Does_Not_Require_Name()
{
var GDR = new GoalDispersalReceipt(10, GoalDispersalStrategy.ExtrapolateFromExistingGoals);
GDR.AddNewDispersalError(GoalDispersalError.ErrorsDuringDisperse, "1", "ERROR");
GDR.AddNewDispersalError(GoalDispersalError.ErrorsDuringDisperse, "2", "ERROR", null);
var obj = new {name = "batman"};
var testFunc = new Func<string, string>((string name) =>
{
if (name == "batman") return null;
return "name";
});
GDR.AddNewDispersalError(GoalDispersalError.ErrorsDuringDisperse, "3", "ERROR", obj.name);
GDR.AddNewDispersalError(GoalDispersalError.ErrorsDuringDisperse, "4", "ERROR", testFunc(obj.name));
Assert.AreEqual(4,GDR.GoalDispersalErrors.Count);
Assert.AreEqual(3, GDR.GoalDispersalErrors.Count(x => x.EmployeeName == null));
}
}
}
@@ -0,0 +1,22 @@
using System;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.API.Internal.Operations.IncentiveApiLib.Persistence;
using NUnit.Framework;
namespace Application.UnitTests.Models
{
public class PayDayTest
{
[Test]
public void PayDay_Predict_2()
{
var service = new DateTimeService();
var date = service.getNextBonusPeriod(new DateTime(2021,10,3));
Assert.AreEqual("10/15/2021", date.ToString("MM/dd/yyyy"));
date = service.getNextBonusPeriod(new DateTime(2021,10,22));
Assert.AreEqual("11/26/2021", date.ToString("MM/dd/yyyy"));
date = service.getNextBonusPeriod(new DateTime(2022,4,17));
Assert.AreEqual("05/27/2022", date.ToString("MM/dd/yyyy"));
}
}
}
@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using LCU.API.Internal.Operations.IncentiveApi.Models;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using NUnit.Framework;
namespace Application.UnitTests.Models
{
public class PersonnelGoalsTest
{
[Test]
public void ApplyGoals_Basic()
{
var goals = new List<Goal>()
{
new Goal()
{
Product = Product.Vehicle,
DepartmentId = 55,
EmployeeId = "11771",
Value = 1
},
new Goal()
{
Product = Product.CheckCard,
DepartmentId = 55,
EmployeeId = "11771",
Value = 34
},
// This department shouldn't have this goal, but they do...
new Goal()
{
Product = Product.CheckCard,
DepartmentId = 55,
EmployeeId = "11772",
Value = 44
},
};
var user = new AppUser()
{
Role = Role.Admin,
AdEmail = "[email protected]",
BaseRole = "Tester",
EmployeeId = "11771",
FullName = "Test McTester",
HomeDepartment = "HOME",
PersonId = 565,
Departments = new List<UserDepartment>()
{
new UserDepartment()
{
DepartmentId = 55
}
}
};
var users = new List<AppUser>()
{
user
};
var personnelGoals = new PersonnelGoals(55, DateTime.Now.Year, DateTime.Now.Month, users);
Assert.NotNull(personnelGoals.Personnel);
Assert.AreEqual(1, personnelGoals.Personnel.Count);
Assert.AreEqual(0,personnelGoals.Goals["11771"].ProductGoals[Product.Vehicle] );
Assert.AreEqual(0,personnelGoals.Goals["11771"].ProductGoals[Product.CheckCard] );
personnelGoals.ApplyAll(goals);
Assert.AreEqual(1,personnelGoals.Goals["11771"].ProductGoals[Product.Vehicle]);
Assert.AreEqual(34,personnelGoals.Goals["11771"].ProductGoals[Product.CheckCard]);
}
}
}
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using LCU.Library.Internal.IncentiveApiModels.Enums;
using NUnit.Framework;
namespace Application.UnitTests.Models
{
public class ProductDetailTest
{
[Test]
public void AssertProductDetailList()
{
// Ensure every product has a detail
foreach (Product product in Enum.GetValues(typeof(Product)))
{
Assert.NotNull(ProductDetail.DetailsForProduct(product));
}
// Ensure there isn't more than one detail per product.
var checkList = new Dictionary<Product, ProductDetail>();
foreach (var detail in ProductDetail.ProductDetails)
{
Assert.False(checkList.ContainsKey(detail.Product));
checkList[detail.Product] = detail;
}
}
}
}
@@ -0,0 +1,69 @@
using LCU.API.Internal.Operations.IncentiveApi.Models;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using NUnit.Framework;
namespace Application.UnitTests.Models
{
public class SettingsTest
{
private Settings _settings;
[Test]
public void Constructs_OrganizationSet_OK()
{
_settings = new Settings();
Assert.AreEqual(_settings.OrganizationSet.Count, 1);
Assert.Contains("MEMEXP", _settings.OrganizationSet.Keys);
Assert.Contains("Member Experience", _settings.OrganizationSet.Values);
}
[Test]
public void Constructs_BusinessLineSet_OK()
{
_settings = new Settings();
Assert.AreEqual(_settings.BusinessLines.Count, 3);
Assert.Contains(BusinessLine.Operations, _settings.BusinessLines);
Assert.Contains(BusinessLine.BranchOperations, _settings.BusinessLines);
Assert.Contains(BusinessLine.MemberServices, _settings.BusinessLines);
}
[Test]
public void Constructs_RegionSet_OK()
{
_settings = new Settings();
Assert.Contains(Region.North, _settings.Regions);
Assert.Contains(Region.South, _settings.Regions);
Assert.Contains(Region.East, _settings.Regions);
Assert.Contains(Region.West, _settings.Regions);
}
[Test]
public void Constructs_PermissionSet_OK()
{
_settings = new Settings();
var permissionCount = Permission.GetAllPermissions().Count;
Assert.AreEqual(permissionCount, _settings.Permissions.Count);
Assert.Contains(Permission.Unknown, _settings.Permissions);
Assert.Contains(Permission.EligibleForReferrals, _settings.Permissions);
Assert.Contains(Permission.HaveSalesGoals, _settings.Permissions);
Assert.Contains(Permission.ViewDashboard, _settings.Permissions);
Assert.Contains(Permission.ViewPerformanceForDepartment, _settings.Permissions);
Assert.Contains(Permission.ViewPerformanceForRegion, _settings.Permissions);
Assert.Contains(Permission.ViewPerformanceForBusinessLine, _settings.Permissions);
Assert.Contains(Permission.ManageDepartmentGoals, _settings.Permissions);
Assert.Contains(Permission.ManageCommissions, _settings.Permissions);
Assert.Contains(Permission.CreateActivity, _settings.Permissions);
Assert.Contains(Permission.AssignPermissionsToAssociates, _settings.Permissions);
Assert.Contains(Permission.AssignAssociatesToDepartment, _settings.Permissions);
Assert.Contains(Permission.TransferActivitiesBetweenDepartments, _settings.Permissions);
Assert.Contains(Permission.TransferActivitiesBetweenAssociates, _settings.Permissions);
Assert.Contains(Permission.GeneratePayoutFiles, _settings.Permissions);
Assert.Contains(Permission.AssignRegionalManager, _settings.Permissions);
Assert.Contains(Permission.AccessTestEnvironments, _settings.Permissions);
}
}
}