-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
md
committed
Nov 21, 2024
1 parent
e4de3c1
commit bb758ad
Showing
1 changed file
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
using Api.StaffingController; | ||
using Core.Absences; | ||
using Core.Agreements; | ||
using Core.Consultants; | ||
using Core.Customers; | ||
using Core.DomainModels; | ||
|
@@ -56,16 +57,39 @@ public void AvailabilityCalculation( | |
Consultants = Substitute.For<List<Consultant>>() | ||
}; | ||
|
||
var customer = new Customer | ||
{ | ||
Id = 1, | ||
Name = "TestCustomer", | ||
Organization = org, | ||
Projects = new List<Engagement>() | ||
}; | ||
|
||
var engagement = new Engagement | ||
{ | ||
Id = 1, | ||
Customer = customer, | ||
State = EngagementState.Order, | ||
IsBillable = true, | ||
Staffings = new List<Staffing>(), | ||
Name = "TestProject", | ||
|
||
}; | ||
|
||
customer.Projects.Add(engagement); | ||
|
||
Consultant consultant = new() | ||
{ | ||
Id = 1, | ||
Name = "Test Variant", | ||
Email = "[email protected]", | ||
GraduationYear = 2010, | ||
Department = department | ||
Department = department, | ||
Projects = new List<Engagement>() | ||
}; | ||
|
||
consultant.Projects.Add(engagement); | ||
|
||
var mondayDateOnly = numberOfHolidays switch | ||
{ | ||
0 => new DateOnly(2023, 9, 4), // Week 36, 4th Sept 2023, (no public holidays) | ||
|
@@ -76,12 +100,17 @@ public void AvailabilityCalculation( | |
}; | ||
|
||
var week = Week.FromDateOnly(mondayDateOnly); | ||
var project = Substitute.For<Engagement>(); | ||
var customer = Substitute.For<Customer>(); | ||
customer.Name = "TestCustomer"; | ||
project.Customer = customer; | ||
project.State = EngagementState.Order; | ||
project.IsBillable = true; | ||
|
||
|
||
|
||
Agreement agreement = new() | ||
{ | ||
Id = 1, | ||
EndDate = new DateTime(2023, 12, 31), | ||
StartDate = new DateTime(2023, 1, 1), | ||
EngagementId = 1, | ||
Engagement = engagement, | ||
}; | ||
|
||
|
||
// TODO: Change this to update consultant data | ||
|
@@ -108,11 +137,11 @@ public void AvailabilityCalculation( | |
if (staffedHours > 0) | ||
consultant.Staffings.Add(new Staffing | ||
{ | ||
Engagement = project, | ||
Engagement = engagement, | ||
Consultant = consultant, | ||
Hours = staffedHours, | ||
Week = week, | ||
EngagementId = project.Id, | ||
EngagementId = engagement.Id, | ||
ConsultantId = consultant.Id | ||
}); | ||
|
||
|
@@ -162,9 +191,12 @@ public void MultiplePlannedAbsences() | |
Name = "Test Variant", | ||
Email = "[email protected]", | ||
GraduationYear = 2010, | ||
Department = department | ||
Department = department, | ||
Projects = new List<Engagement>() | ||
}; | ||
|
||
consultant.Projects.Add(Substitute.For<Engagement>()); | ||
|
||
var week = new Week(2000, 1); | ||
|
||
consultant.PlannedAbsences.Add(new PlannedAbsence | ||
|