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() { 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 = "tester@test.com", BaseRole = "Tester", EmployeeId = "11771", FullName = "Test McTester", HomeDepartment = "HOME", PersonId = 565, Departments = new List() { new UserDepartment() { DepartmentId = 55, Role = Role.Admin } } }; var users = new List() { 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] ); } } }