public void ToApiRestorePreviousVersionsRequest() { // ARRANGE string expectedStrategyValue = "overwrite"; ResolutionStrategy expectedStrategy = ResolutionStrategy.Overwrite; ApiRestorePreviousVersionsRequest expected = FactoryNode.ApiRestorePreviousVersionsRequest; expected.ResolutionStrategy = expectedStrategyValue; RestorePreviousVersionsRequest param = new RestorePreviousVersionsRequest(expected.DeletedNodeIds) { KeepShareLinks = expected.KeepShareLinks, NewParentNodeId = expected.ParentId, ResolutionStrategy = expectedStrategy }; Mock.Arrange(() => EnumConverter.ConvertResolutionStrategyToValue(expectedStrategy)).Returns(expectedStrategyValue); // ACT ApiRestorePreviousVersionsRequest actual = NodeMapper.ToApiRestorePreviousVersionsRequest(param); // ASSERT Assert.Equal(expected, actual, new ApiRestorePreviousVersionsRequestComparer()); }
public void ToApiMoveNodesRequest() { // ARRANGE ApiMoveNodesRequest expected = FactoryNode.ApiMoveNodesRequest; expected.ResolutionStrategy = "overwrite"; MoveNodesRequest param = new MoveNodesRequest(12, new List <MoveNode>(expected.Nodes.Count), ResolutionStrategy.Overwrite, expected.KeepShareLinks); foreach (ApiMoveNode currentApi in expected.Nodes) { param.NodesToBeMoved.Add(new MoveNode(currentApi.NodeId, currentApi.NewName)); } Mock.Arrange(() => EnumConverter.ConvertResolutionStrategyToValue(param.ResolutionStrategy)).Returns(expected.ResolutionStrategy); // ACT ApiMoveNodesRequest actual = NodeMapper.ToApiMoveNodesRequest(param); // ASSERT Assert.Equal(expected, actual, new ApiMoveNodesRequestComparer()); }
internal static ApiCompleteFileUpload ToApiCompleteFileUpload(FileUploadRequest fileUploadRequest) { ApiCompleteFileUpload apiCompleteFileUpload = new ApiCompleteFileUpload { FileName = fileUploadRequest.Name, ResolutionStrategy = EnumConverter.ConvertResolutionStrategyToValue(fileUploadRequest.ResolutionStrategy) }; return(apiCompleteFileUpload); }
public void ConvertResolutionStrategyToValue(ResolutionStrategy value, string expected) { // ARRANGE // ACT string actual = EnumConverter.ConvertResolutionStrategyToValue(value); // ASSERT Assert.Equal(expected, actual); }
internal static ApiRestorePreviousVersionsRequest ToApiRestorePreviousVersionsRequest(RestorePreviousVersionsRequest request) { ApiRestorePreviousVersionsRequest apiRequest = new ApiRestorePreviousVersionsRequest { DeletedNodeIds = request.RestoreVersionIds, KeepShareLinks = request.KeepShareLinks, ParentId = request.NewParentNodeId, ResolutionStrategy = EnumConverter.ConvertResolutionStrategyToValue(request.ResolutionStrategy) }; return(apiRequest); }
internal static ApiMoveNodesRequest ToApiMoveNodesRequest(MoveNodesRequest request) { List <ApiMoveNode> moveNodesList = new List <ApiMoveNode>(); foreach (MoveNode currentMoveNode in request.NodesToBeMoved) { ApiMoveNode apiMoveNode = new ApiMoveNode { NodeId = currentMoveNode.NodeId, NewName = currentMoveNode.NewName }; moveNodesList.Add(apiMoveNode); } ApiMoveNodesRequest apiMoveNodesRequest = new ApiMoveNodesRequest { Nodes = moveNodesList, ResolutionStrategy = EnumConverter.ConvertResolutionStrategyToValue(request.ResolutionStrategy), KeepShareLinks = request.KeepShareLinks }; return(apiMoveNodesRequest); }
public void ToApiCompleteFileUpload() { // ARRANGE ResolutionStrategy paramStrategy = ResolutionStrategy.Overwrite; string expectedStrategy = "overwrite"; ApiCompleteFileUpload expected = FactoryFile.ApiCompleteFileUpload; expected.FileKey = null; expected.ResolutionStrategy = expectedStrategy; FileUploadRequest param = new FileUploadRequest(63534, expected.FileName) { ResolutionStrategy = paramStrategy }; Mock.Arrange(() => EnumConverter.ConvertResolutionStrategyToValue(paramStrategy)).Returns(expectedStrategy); // ACT ApiCompleteFileUpload actual = FileMapper.ToApiCompleteFileUpload(param); // ASSERT Assert.Equal(expected, actual, new ApiCompleteFileUploadComparer()); }