Пример #1
0
        public void FromApiDeletedNodeVersionsList_Null()
        {
            // ARRANGE
            PreviousVersionList expected = null;

            ApiDeletedNodeVersionsList param = null;

            // ACT
            PreviousVersionList actual = NodeMapper.FromApiDeletedNodeVersionsList(param);

            // ASSERT
            Assert.Equal(expected, actual, new PreviousVersionListComparer());
        }
Пример #2
0
        public PreviousVersionList GetPreviousVersions(long parentId, NodeType type, string nodeName, long?offset = null, long?limit = null)
        {
            _client.Executor.CheckApiServerVersion();

            #region Parameter Validation

            parentId.MustPositive(nameof(parentId));
            offset.NullableMustNotNegative(nameof(offset));
            limit.NullableMustPositive(nameof(limit));
            nodeName.MustNotNullOrEmptyOrWhitespace(nameof(nodeName));

            #endregion

            IRestRequest restRequest =
                _client.Builder.GetPreviousVersions(parentId, EnumConverter.ConvertNodeTypeEnumToValue(type), nodeName, offset, limit);
            ApiDeletedNodeVersionsList result =
                _client.Executor.DoSyncApiCall <ApiDeletedNodeVersionsList>(restRequest, RequestType.GetPreviousVersions);
            return(NodeMapper.FromApiDeletedNodeVersionsList(result));
        }
Пример #3
0
        public void FromApiDeletedNodeVersionsList()
        {
            // ARRANGE
            Classification expectedClassification = Classification.Confidential;
            NodeType       expectedType           = NodeType.File;
            string         expectedTypeValue      = "file";

            PreviousVersionList expected = FactoryNode.PreviousVersionList;

            ApiDeletedNodeVersionsList param = new ApiDeletedNodeVersionsList {
                Range = new ApiRange {
                    Offset = expected.Offset,
                    Limit  = expected.Limit,
                    Total  = expected.Total
                },
                Items = new List <ApiDeletedNodeVersion>(expected.Items.Count)
            };

            foreach (PreviousVersion current in expected.Items)
            {
                current.Classification = expectedClassification;
                current.Type           = expectedType;
                ApiDeletedNodeVersion currentApi = new ApiDeletedNodeVersion()
                {
                    Type           = expectedTypeValue,
                    ParentId       = current.ParentId,
                    ParentPath     = current.ParentPath,
                    Name           = current.Name,
                    AccessedAt     = current.AccessedAt,
                    Classification = (int)expectedClassification,
                    CreatedAt      = current.CreatedAt,
                    CreatedBy      = new ApiUserInfo {
                        Id          = current.CreatedBy.Id.Value,
                        DisplayName = current.CreatedBy.DisplayName,
                        AvatarUuid  = current.CreatedBy.AvatarUUID
                    },
                    DeletedAt = current.DeletedAt,
                    DeletedBy = new ApiUserInfo {
                        Id          = current.DeletedBy.Id.Value,
                        DisplayName = current.DeletedBy.DisplayName,
                        AvatarUuid  = current.DeletedBy.AvatarUUID
                    },
                    ExpireAt    = current.ExpireAt,
                    Id          = current.Id,
                    IsEncrypted = current.IsEncrypted,
                    Notes       = current.Notes,
                    Size        = current.Size,
                    UpdatedAt   = current.UpdatedAt,
                    UpdatedBy   = new ApiUserInfo {
                        Id          = current.UpdatedBy.Id.Value,
                        DisplayName = current.UpdatedBy.DisplayName,
                        AvatarUuid  = current.UpdatedBy.AvatarUUID
                    }
                };
                param.Items.Add(currentApi);
                Mock.Arrange(() => NodeMapper.FromApiDeletedNodeVersion(currentApi)).Returns(current);
            }

            // ACT
            PreviousVersionList actual = NodeMapper.FromApiDeletedNodeVersionsList(param);

            // ASSERT
            Assert.Equal(expected, actual, new PreviousVersionListComparer());
        }