|
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-go/ |
|
client, ctx := UploadTestFileToStorage(t, localFileName, remoteBaseTestDataFolder+"/"+remoteFileName) |
|
|
|
getResult, _, err := client.TasksApi.GetAssignment(ctx, &requests.GetAssignmentOpts{ |
|
AssignmentUid: 63, |
|
Name: remoteFileName, |
|
Folder: optional.NewString(remoteBaseTestDataFolder), |
|
}) |
|
if err != nil { |
|
t.Error(err) |
|
} |
|
assert.Equal(t, int32(200), getResult.Code) |
|
assert.NotNil(t, getResult.Assignment) |
|
|
|
getResult.Assignment.Cost = 100 |
|
getResult.Assignment.Start = CreateTime(2001, 9, 10, 0, 0, 0) |
|
getResult.Assignment.Finish = CreateTime(2002, 9, 10, 0, 0, 0) |
|
newBaselineType := models.BASELINE1_BaselineType |
|
newStart := CreateTime(2002, 9, 10, 0, 0, 0) |
|
getResult.Assignment.Baselines = []models.AssignmentBaseline{ |
|
{ |
|
BaselineNumber: &newBaselineType, |
|
Start: &newStart, |
|
}, |
|
} |
|
allocatedActualWork := "10:10:10" |
|
getResult.Assignment.ActualWork = &allocatedActualWork |
|
getResult.Assignment.ActualCost = 100 |
|
getResult.Assignment.ActualStart = CreateTime(2001, 9, 10, 0, 0, 0) |
|
getResult.Assignment.ActualFinish = CreateTime(2002, 9, 10, 0, 0, 0) |
|
allocatedOvertimeActualWork := "100:10:10" |
|
getResult.Assignment.ActualOvertimeWork = &allocatedOvertimeActualWork |
|
allocatedWork := "80:10:10" |
|
getResult.Assignment.Work = &allocatedWork |
|
getResult.Assignment.Uid = 63 |
|
getResult.Assignment.Vac = 10 |
|
newWorkContourType := models.CONTOURED_WorkContourType |
|
getResult.Assignment.WorkContour = &newWorkContourType |
|
newTimeUnitType := models.HOUR_TimeUnitType |
|
newTimephasedDataType := models.ASSIGNMENT_REMAINING_WORK_TimephasedDataType |
|
getResult.Assignment.TimephasedData = []models.TimephasedData{ |
|
{ |
|
Uid: getResult.Assignment.Uid, |
|
Start: CreateTime(2001, 9, 10, 9, 0, 0), |
|
Finish: CreateTime(2001, 9, 10, 14, 0, 0), |
|
Unit: &newTimeUnitType, |
|
Value: "4:0:0", |
|
TimephasedDataType: &newTimephasedDataType, |
|
}, |
|
} |
|
|
|
putResponse, _, err := client.TasksApi.PutAssignment(ctx, &requests.PutAssignmentOpts{ |
|
Mode: optional.NewString(string(models.NONE_CalculationMode)), |
|
Recalculate: optional.NewBool(false), |
|
AssignmentUid: getResult.Assignment.Uid, |
|
Assignment: *getResult.Assignment, |
|
Name: remoteFileName, |
|
Folder: optional.NewString(remoteBaseTestDataFolder), |
|
}) |
|
if err != nil { |
|
t.Error(err) |
|
} |
|
assert.Equal(t, int32(200), putResponse.Code) |
|
assert.NotNil(t, putResponse.Assignment) |
|
assert.Equal(t, getResult.Assignment.Uid, putResponse.Assignment.Uid) |
|
assert.Equal(t, getResult.Assignment.Vac, putResponse.Assignment.Vac) |
|
assert.NotEqual(t, getResult.Assignment.Cost, putResponse.Assignment.Cost, "Calculated fields must be overwritten") |
|
assert.Equal(t, getResult.Assignment.Start, putResponse.Assignment.Start) |
|
assert.Equal(t, getResult.Assignment.Finish, putResponse.Assignment.Finish) |
|
assert.Equal(t, "80.10:10:00", *putResponse.Assignment.Work) |
|
assert.Equal(t, *getResult.Assignment.ActualWork, *putResponse.Assignment.ActualWork) |
|
assert.Equal(t, getResult.Assignment.ActualStart, putResponse.Assignment.ActualStart) |
|
assert.Equal(t, getResult.Assignment.ActualFinish, putResponse.Assignment.ActualFinish) |
|
assert.Equal(t, "100.10:10:00", *putResponse.Assignment.ActualOvertimeWork) |
|
assert.Equal(t, 1, len(putResponse.Assignment.Baselines)) |
|
assert.Equal(t, models.BASELINE1_BaselineType, *putResponse.Assignment.Baselines[0].BaselineNumber) |
|
assert.Equal(t, getResult.Assignment.Baselines[0].Start, putResponse.Assignment.Baselines[0].Start) |
|
assert.Equal(t, 1, len(putResponse.Assignment.TimephasedData)) |
|
assert.Equal(t, getResult.Assignment.TimephasedData[0].Uid, putResponse.Assignment.TimephasedData[0].Uid) |
|
assert.Equal(t, "PT4H0M0S", putResponse.Assignment.TimephasedData[0].Value) |
|
assert.Equal(t, getResult.Assignment.TimephasedData[0].Start, putResponse.Assignment.TimephasedData[0].Start) |
|
assert.Equal(t, getResult.Assignment.TimephasedData[0].Finish, putResponse.Assignment.TimephasedData[0].Finish) |
|
assert.Equal(t, getResult.Assignment.TimephasedData[0].TimephasedDataType, putResponse.Assignment.TimephasedData[0].TimephasedDataType) |