I’ve found some issues when I set the ActualStart, ActualFinish and ActualDuration of a zero days milestone task. The setting is ignored after I set ActualFinish (see example above).
We upgraded the assembly version of Aspose.Tasks from 17.3 to 17.7. This error didn’t occur in Aspose Tasks 17.3, but occurs on 17.5, 17.6 and 17.7.
The upgrade from 17.3 to 17.7 is very important to us, since the new version solves at least 5 problems reported by our customers.
public void Setting_Complete_Percent_To_Milestone_Task()
{
using (var stream = ProjetoPadrao.Carregar())
{
var project = OpenProject(stream);
DateTime start = new DateTime(2017, 08, 18, 9, 0, 0);
DateTime finish = new DateTime(2017, 08, 18, 9, 0, 0);
Duration duration = project.GetDuration(0);
DateTime actualStart = new DateTime(2017, 08, 21, 9, 0, 0);
DateTime actualFinish = new DateTime(2017, 08, 21, 18, 0, 0);
Duration actualDuration = project.GetDuration(8, TimeUnitType.Hour);
project.CalculationMode = CalculationMode.Automatic;
var task1 = project.RootTask.Children.Add("T1");
task1.Set(Tsk.Start, start);
task1.Set(Tsk.Duration, duration);
task1.Set(Tsk.Finish, finish);
var resource1 = project.Resources.Add("R1");
project.ResourceAssignments.Add(task1, resource1);
// These assertions do alright!
Assert.AreEqual(start, task1.Get(Tsk.Start), "Error! Task T1 should be started at 2017-08-21 09:00:00");
Assert.AreEqual(finish, task1.Get(Tsk.Finish), "Error! Task T1 should be finished at 2017-08-21 18:00:00");
Assert.AreEqual(duration, task1.Get(Tsk.Duration), "Error! Task T1 should have 1 day of duration");
Assert.IsTrue(task1.Get(Tsk.IsMilestone), "Error! Task T1 should be a milestone");
// Set actual dates and durations of task
task1.Set(Tsk.ActualStart, actualStart);
task1.Set(Tsk.ActualDuration, actualDuration);
task1.Set(Tsk.ActualFinish, actualFinish);
// These assertions didn't work...
Assert.AreEqual(actualStart, task1.Get(Tsk.ActualStart), "Error! Task T1 should be started at 2017-08-21 09:00:00");
Assert.AreEqual(actualFinish, task1.Get(Tsk.ActualFinish), "Error! Task T1 should be finished at 2017-08-21 18:00:00");
Assert.AreEqual(actualDuration, task1.Get(Tsk.ActualDuration), "Error! Task T1 should have 1 day of duration");
}
}