Skip to content

Commit

Permalink
[TASKSCLOUD-384] - Deployed new 20.6 version.
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanAndreychikov committed Jun 26, 2020
1 parent a38274b commit 482e071
Show file tree
Hide file tree
Showing 19 changed files with 833 additions and 136 deletions.
31 changes: 31 additions & 0 deletions Aspose.Tasks.Cloud.Sdk.Tests/Assignment/TestAssignments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,37 @@ public async Task TestAddAssignment()
Assert.AreEqual(getTaskResponse.Task.Cost, getResponse.Assignment.Cost);
}

[Test]
public async Task TestAddAssignmentWithCost()
{
var remoteName = await UploadFileToStorageAsync("Cost_Res.mpp");

var response = await TasksApi.PostAssignmentAsync(new PostAssignmentRequest
{
ResourceUid = 1,
Cost = 2,
TaskUid = 0,
Name = remoteName,
Folder = this.DataFolder
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.IsNotNull(response.AssignmentItem);
var assignmentUid = response.AssignmentItem.Uid;

var getResponse = await TasksApi.GetAssignmentAsync(new GetAssignmentRequest
{
AssignmentUid = assignmentUid,
Name = remoteName,
Folder = this.DataFolder
});

Assert.AreEqual((int)HttpStatusCode.OK, getResponse.Code);
Assert.IsNotNull(getResponse.Assignment);
Assert.AreEqual(0, getResponse.Assignment.TaskUid);
Assert.AreEqual(2, getResponse.Assignment.Cost);
}

[Test]
public async Task TestEditAssignment()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task TestGetDocumentProperties()
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.AreEqual(51, response.Properties.List.Count);
Assert.AreEqual(52, response.Properties.List.Count);
Assert.AreEqual("Title", response.Properties.List[0].Name);
Assert.AreEqual("Home Move", response.Properties.List[0].Value);
}
Expand Down Expand Up @@ -96,7 +96,7 @@ public async Task TestEditDocumentProperty()
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.AreEqual(51, response.Properties.List.Count);
Assert.AreEqual(52, response.Properties.List.Count);
Assert.AreEqual("Title", response.Properties.List[0].Name);
Assert.AreEqual("New title value", response.Properties.List[0].Value);
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public async Task TestEditDocumentPropertyViaPost()
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.AreEqual(51, response.Properties.List.Count);
Assert.AreEqual(52, response.Properties.List.Count);
Assert.AreEqual("Title", response.Properties.List[0].Name);
Assert.AreEqual("New title value", response.Properties.List[0].Value);
}
Expand Down Expand Up @@ -154,7 +154,7 @@ public async Task TestAddNonExistingDocumentProperty()
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.AreEqual(51, response.Properties.List.Count);
Assert.AreEqual(52, response.Properties.List.Count);
Assert.IsNull(response.Properties.List.Where(p => p.Name == "new property").FirstOrDefault());
}
}
Expand Down
4 changes: 2 additions & 2 deletions Aspose.Tasks.Cloud.Sdk.Tests/Project/TestGetPageCount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task TestGetPageCountWithPresentationFormat()
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.AreEqual(2, response.PageCount);
Assert.AreEqual(4, response.PageCount);
}

[Test]
Expand All @@ -70,7 +70,7 @@ public async Task TestGetPageCountWithPresentationFormatAndDateInterval()
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.AreEqual(2, response.PageCount);
Assert.AreEqual(4, response.PageCount);
}
}
}
35 changes: 34 additions & 1 deletion Aspose.Tasks.Cloud.Sdk.Tests/Project/TestImportProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public async Task TestImportFromMsp()

[Test]
[Ignore("Ignored because real credentials for project server online is required.")]
public async Task TestImportFromProjectOnline()
public async Task TestImportFromProjectOnlineByTokenCredentials()
{
var fileName = "NewProductDev.mpp";
var getFileRequest = new DownloadFileRequest
Expand Down Expand Up @@ -123,5 +123,38 @@ public async Task TestImportFromProjectOnline()
binaryResponse.Dispose();
await TasksApi.DeleteFileAsync((new DeleteRequest(fileName)));
}

[Test]
[Ignore("Ignored because real credentials for project server online is required.")]
public async Task TestImportFromProjectOnlineByLoginAndPasswordCredentials()
{
var fileName = "NewProductDev.mpp";
var getFileRequest = new DownloadFileRequest
{
Path = fileName
};
var importFileRequest = new PutImportProjectFromProjectOnlineRequest
{
Name = fileName,
Guid = Guid.Parse("E6426C44-D6CB-4B9C-AF16-48910ACE0F54"),
UserName = "SomeLogin",
XSharepointPassword = "SomePassword",
SiteUrl = "https://your_company_name.sharepoint.com",
Format = ProjectFileFormat.Xml
};
Stream binaryResponse = null;

var exception = Assert.ThrowsAsync<ApiException>(async () => binaryResponse = await TasksApi.DownloadFileAsync(getFileRequest));
Assert.AreEqual(HttpStatusCode.NotFound, exception.HttpStatusCode);

var response = await TasksApi.PutImportProjectFromProjectOnlineAsync(importFileRequest);
Assert.AreEqual(HttpStatusCode.OK.ToString(), (string)response.Status);

Assert.DoesNotThrowAsync(async () => binaryResponse = await TasksApi.DownloadFileAsync(getFileRequest));
Assert.That(binaryResponse, Is.Not.Null);

binaryResponse.Dispose();
await TasksApi.DeleteFileAsync((new DeleteRequest(fileName)));
}
}
}
81 changes: 79 additions & 2 deletions Aspose.Tasks.Cloud.Sdk.Tests/ProjectOnline/TestProjectList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,93 @@ internal sealed class TestProjectList : BaseTestContext
{
[Test]
[Ignore("Ignored because real credentials for project server online is required.")]
public async Task TestGetProjectList()
public async Task TestGetProjectListByTokenCredentials()
{
var response = await TasksApi.GetProjectListAsync(new GetProjectListRequest
{
Token = "SOMESECRETTOKEN",
SiteUrl = "https://your_company_name.sharepoint.com"
SiteUrl = "your_company_name.sharepoint.com"
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.That(response.Projects, Is.Not.Empty);
}

[Test]
[Ignore("Ignored because real credentials for project server online is required.")]
public async Task TestGetProjectListByLoginAndPasswordCredentials()
{
var response = await TasksApi.GetProjectListAsync(new GetProjectListRequest
{
UserName = "SomeLogin",
XSharepointPassword = "SomePassword",
SiteUrl = "your_company_name.sharepoint.com"
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.That(response.Projects, Is.Not.Empty);
}

[Test]
[Ignore("Ignored because real credentials for project server online is required.")]
public async Task TestCreateNewProjectByTokenCredentials()
{
var remoteName = await UploadFileToStorageAsync("NewProductDev.mpp");
var response = await TasksApi.CreateNewProjectAsync(new CreateNewProjectRequest()
{
Name = remoteName,
XProjectOnlineToken = "SOMESECRETTOKEN",
SiteUrl = "your_company_name.sharepoint.com"
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
}

[Test]
[Ignore("Ignored because real credentials for project server online is required.")]
public async Task TestCreateNewProjectByLoginAndPasswordCredentials()
{
var remoteName = await UploadFileToStorageAsync("NewProductDev.mpp");
var response = await TasksApi.CreateNewProjectAsync(new CreateNewProjectRequest()
{
Name = remoteName,
UserName = "SomeLogin",
XSharepointPassword = "SomePassword",
SiteUrl = "your_company_name.sharepoint.com"
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
}

[Test]
[Ignore("Ignored because real credentials for project server online is required.")]
public async Task TestUpdateProjectByTokenCredentials()
{
var remoteName = await UploadFileToStorageAsync("NewProductDev.mpp");
var response = await TasksApi.UpdateProjectAsync(new UpdateProjectRequest()
{
Name = remoteName,
XProjectOnlineToken = "SOMESECRETTOKEN",
SiteUrl = "your_company_name.sharepoint.com"
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
}

[Test]
[Ignore("Ignored because real credentials for project server online is required.")]
public async Task TestUpdateProjectByLoginAndPasswordCredentials()
{
var remoteName = await UploadFileToStorageAsync("NewProductDev.mpp");
var response = await TasksApi.UpdateProjectAsync(new UpdateProjectRequest()
{
Name = remoteName,
UserName = "SomeLogin",
XSharepointPassword = "SomePassword",
SiteUrl = "your_company_name.sharepoint.com"
});

Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ public async Task TestRecalculateProjectWithErrors()

Assert.AreEqual((int)HttpStatusCode.OK, recalculationResponse.Code);
var validationResult = recalculationResponse.Result;
Assert.AreEqual(ProjectValidationState.HasErrors, validationResult.ValidationState);
Assert.AreEqual("Actual start date of task is greater than actual finish date. Task name: New task Name; Actual start date: 10/20/2000 00:00:00; Actual finish date: 10/09/2000 00:00:00", validationResult.ValidationErrorMessage);
Assert.AreEqual(ProjectValidationState.Valid, validationResult.ValidationState);
}


Expand Down
Binary file not shown.
Loading

0 comments on commit 482e071

Please sign in to comment.