Beispiel #1
0
        public void FromApiDeletedNodeSummary()
        {
            // ARRANGE
            NodeType expectedType      = NodeType.File;
            string   expectedTypeValue = "file";

            RecycleBinItem expected = FactoryNode.RecycleBinItem;

            expected.Type = expectedType;

            ApiDeletedNodeSummary param = new ApiDeletedNodeSummary()
            {
                Type              = expectedTypeValue,
                ParentId          = expected.ParentId,
                ParentPath        = expected.ParentPath,
                Name              = expected.Name,
                FirstDeletedAt    = expected.FirstDeletedAt,
                LastDeletedAt     = expected.LastDeletedAt,
                LastDeletedNodeId = expected.LastDeletedNodeId,
                CntVersions       = expected.VersionsCount
            };

            Mock.Arrange(() => EnumConverter.ConvertValueToNodeTypeEnum(expectedTypeValue)).Returns(expectedType);

            // ACT
            RecycleBinItem actual = NodeMapper.FromApiDeletedNodeSummary(param);

            // ASSERT
            Assert.Equal(expected, actual, new RecycleBinItemComparer());
        }
Beispiel #2
0
        public void FromApiDeletedNodeSummary_Null()
        {
            // ARRANGE
            RecycleBinItem        expected = null;
            ApiDeletedNodeSummary param    = null;

            // ACT
            RecycleBinItem actual = NodeMapper.FromApiDeletedNodeSummary(param);

            // ASSERT
            Assert.Equal(expected, actual, new RecycleBinItemComparer());
        }
Beispiel #3
0
        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());
        }