|
| 1 | + |
| 2 | +// -------------------------------------------------------------------------------------------------------------------- |
| 3 | +// <copyright company="Aspose" file="TestOutlineCodes.cs"> |
| 4 | +// Copyright (c) 2018 Aspose.Tasks for Cloud |
| 5 | +// </copyright> |
| 6 | +// <summary> |
| 7 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | +// of this software and associated documentation files (the "Software"), to deal |
| 9 | +// in the Software without restriction, including without limitation the rights |
| 10 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | +// copies of the Software, and to permit persons to whom the Software is |
| 12 | +// furnished to do so, subject to the following conditions: |
| 13 | +// |
| 14 | +// The above copyright notice and this permission notice shall be included in all |
| 15 | +// copies or substantial portions of the Software. |
| 16 | +// |
| 17 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | +// SOFTWARE. |
| 24 | +// </summary> |
| 25 | +// -------------------------------------------------------------------------------------------------------------------- |
| 26 | + |
| 27 | +using Aspose.Tasks.Cloud.Sdk.Model.Requests; |
| 28 | +using Aspose.Tasks.Cloud.Sdk.Tests.Base; |
| 29 | +using NUnit.Framework; |
| 30 | +using System.Net; |
| 31 | +using System.Threading.Tasks; |
| 32 | + |
| 33 | +namespace Aspose.Tasks.Cloud.Sdk.Tests.Tasks |
| 34 | +{ |
| 35 | + [TestFixture] |
| 36 | + public class TestOutlineCodes : BaseTestContext |
| 37 | + { |
| 38 | + [Test] |
| 39 | + public async Task TestGetOutlineCodes() |
| 40 | + { |
| 41 | + var remoteName = await UploadFileToStorageAsync("NewProductDev.mpp"); |
| 42 | + |
| 43 | + var response = await TasksApi.GetOutlineCodesAsync(new GetOutlineCodesRequest |
| 44 | + { |
| 45 | + Name = remoteName, |
| 46 | + Folder = this.DataFolder |
| 47 | + }); |
| 48 | + |
| 49 | + Assert.AreEqual((int)HttpStatusCode.OK, response.Code); |
| 50 | + Assert.IsNotNull(response.OutlineCodes); |
| 51 | + Assert.AreEqual(2, response.OutlineCodes.List.Count); |
| 52 | + } |
| 53 | + |
| 54 | + [Test] |
| 55 | + public async Task TestGetOutlineCode() |
| 56 | + { |
| 57 | + var remoteName = await UploadFileToStorageAsync("NewProductDev.mpp"); |
| 58 | + |
| 59 | + var response = await TasksApi.GetOutlineCodeByIndexAsync(new GetOutlineCodeByIndexRequest |
| 60 | + { |
| 61 | + Index = 1, |
| 62 | + Name = remoteName, |
| 63 | + Folder = this.DataFolder |
| 64 | + }); |
| 65 | + |
| 66 | + Assert.AreEqual((int)HttpStatusCode.OK, response.Code); |
| 67 | + Assert.IsNotNull(response.OutlineCode); |
| 68 | + Assert.AreEqual("F45D601B-70C5-E311-A5BA-D43D7E937F92", response.OutlineCode.Guid); |
| 69 | + } |
| 70 | + |
| 71 | + [Test] |
| 72 | + public async Task TestDeleteOutlineCodeByIndex() |
| 73 | + { |
| 74 | + var remoteName = await UploadFileToStorageAsync("NewProductDev.mpp"); |
| 75 | + |
| 76 | + var response = await TasksApi.DeleteOutlineCodeByIndexAsync(new DeleteOutlineCodeByIndexRequest |
| 77 | + { |
| 78 | + Index = 1, |
| 79 | + Name = remoteName, |
| 80 | + Folder = this.DataFolder |
| 81 | + }); |
| 82 | + |
| 83 | + Assert.AreEqual((int)HttpStatusCode.OK, response.Code); |
| 84 | + |
| 85 | + var getResponse = await TasksApi.GetOutlineCodesAsync(new GetOutlineCodesRequest |
| 86 | + { |
| 87 | + Name = remoteName, |
| 88 | + Folder = this.DataFolder |
| 89 | + }); |
| 90 | + |
| 91 | + Assert.AreEqual((int)HttpStatusCode.OK, getResponse.Code); |
| 92 | + Assert.IsNotNull(getResponse.OutlineCodes); |
| 93 | + Assert.AreEqual(1, getResponse.OutlineCodes.List.Count); |
| 94 | + Assert.AreEqual(1, getResponse.OutlineCodes.List[0].Index); |
| 95 | + } |
| 96 | + } |
| 97 | +} |
0 commit comments