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

66 lines
2.3 KiB
C#

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