Files
2026-03-17 09:53:09 -05:00

75 lines
2.5 KiB
C#

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]);
}
}
}