public void FromApiDeletedNodeSummaryList_Null() { // ARRANGE RecycleBinItemList expected = null; ApiDeletedNodeSummaryList param = null; // ACT RecycleBinItemList actual = NodeMapper.FromApiDeletedNodeSummaryList(param); // ASSERT Assert.Equal(expected, actual, new RecycleBinItemListComparer()); }
public RecycleBinItemList GetRecycleBinItems(long parentRoomId, long?offset = null, long?limit = null) { _client.Executor.CheckApiServerVersion(); #region Parameter Validation parentRoomId.MustPositive(nameof(parentRoomId)); offset.NullableMustNotNegative(nameof(offset)); limit.NullableMustPositive(nameof(limit)); #endregion IRestRequest restRequest = _client.Builder.GetRecycleBin(parentRoomId, offset, limit); ApiDeletedNodeSummaryList result = _client.Executor.DoSyncApiCall <ApiDeletedNodeSummaryList>(restRequest, RequestType.GetRecycleBin); return(NodeMapper.FromApiDeletedNodeSummaryList(result)); }
internal static RecycleBinItemList FromApiDeletedNodeSummaryList(ApiDeletedNodeSummaryList apiNodeList) { if (apiNodeList == null) { return(null); } RecycleBinItemList nodeList = new RecycleBinItemList { Offset = apiNodeList.Range.Offset, Limit = apiNodeList.Range.Limit, Total = apiNodeList.Range.Total, Items = new List <RecycleBinItem>() }; foreach (ApiDeletedNodeSummary currentNode in apiNodeList.Items) { nodeList.Items.Add(FromApiDeletedNodeSummary(currentNode)); } return(nodeList); }
public void FromApiDeletedNodeSummaryList() { // ARRANGE NodeType expectedType = NodeType.File; string expectedTypeValue = "file"; RecycleBinItemList expected = FactoryNode.RecycleBinItemList; ApiDeletedNodeSummaryList param = new ApiDeletedNodeSummaryList { Range = new ApiRange { Offset = expected.Offset, Limit = expected.Limit, Total = expected.Total }, Items = new List <ApiDeletedNodeSummary>(expected.Items.Count) }; foreach (RecycleBinItem current in expected.Items) { current.Type = expectedType; ApiDeletedNodeSummary currentApi = new ApiDeletedNodeSummary { Type = expectedTypeValue, CntVersions = current.VersionsCount, FirstDeletedAt = current.FirstDeletedAt, LastDeletedAt = current.LastDeletedAt, LastDeletedNodeId = current.LastDeletedNodeId, Name = current.Name, ParentId = current.ParentId, ParentPath = current.ParentPath }; param.Items.Add(currentApi); Mock.Arrange(() => NodeMapper.FromApiDeletedNodeSummary(currentApi)).Returns(current); } // ACT RecycleBinItemList actual = NodeMapper.FromApiDeletedNodeSummaryList(param); // ASSERT Assert.Equal(expected, actual, new RecycleBinItemListComparer()); }