Hi Kashif,
Thanks for replying.
I'm having another issue on my migration and it's related to 'ResourceAssignment'.
I have several unit tests failing because they check resource assignments and I don't exactly get why this behavior has changed.
OLD TEST v6.4.0 (simplified version):
Project project = new Project();
project.RootTask = new Task("root task") { ParentProject = project };
var task1 = new Task("task1") { ParentProject = project };
project.RootTask.Children.Add(task1);
Assert.AreEqual(0, project.ResourceAssignments.Count);
Assert.AreEqual(0, task1.Assignments.Count);
var resource1 = new Resource("resource1");
project.Resources.Add(resource1);
project.ResourceAssignments.Add(new ResourceAssignment(task1, resource1));
Assert.AreEqual(1, project.ResourceAssignments.Count);
Assert.AreEqual(1, task1.Assignments.Count);
TEST v9.3.0 (simplified version FAILING)
var project = new Project();
var task1 = project.RootTask.Children.Add("task1");
var task2 = project.RootTask.Children.Add("task2");
Assert.AreEqual(0, project.ResourceAssignments.Count); //FAILS because 'count = 2'
Assert.AreEqual(0, task1.Assignments.Count); //FAILS because 'count = 1'
Assert.AreEqual(0, task2.Assignments.Count); //FAILS because 'count = 1'
At this point 'project.ResourceAssignments' should have 0 elements but somehow 'ResourceAssignments' has 2 and each element has 'Task' porperty already set with each task but doesn't have 'Resource' property set (which make sense because I didn't actually created an resource assignment).
Resource resource1 = project.Resources.Add("resource1");
project.ResourceAssignments.Add(task1, resource1);
I expect that after this two lines 'project.ResourceAssignments' should have 1 element with both props set ('Task' and 'Resource').
So two doubts:
1- why creating a task already creates an assignment for it even if it doesn't have it?
2- is there a way to check that no resource has been assigned to the task?