/// <summary> /// When the expected result found differences, execute the analysis of received response. /// </summary> /// <param name="result">Result from API call to be analysed.</param> /// <param name="expectedDiffBlocks">Expected differences.</param> private static void AssertDifferenceFounds(ClientSideDiffResult result, params ClientSideDiffBlock[] expectedDiffBlocks) { Assert.AreEqual("DifferencesFound", result.Status); Assert.AreEqual(expectedDiffBlocks.Length, result.DiffBlocks.Count); for (int i = 0; i < expectedDiffBlocks.Length; i++) { ClientSideDiffBlock expected = expectedDiffBlocks[i]; ClientSideDiffBlock resultDiffBlock = result.DiffBlocks.ElementAt(i); Assert.AreEqual(expected.Offset, resultDiffBlock.Offset); Assert.AreEqual(expected.Lenght, resultDiffBlock.Lenght); } }
public async Task GetDiffDataShouldReturnOneDifferenceFoundWhenDifferencesAreInTheMiddleOfLeftBlock() { // Arrange var leftBlock = new byte[] { 1, 2, 0, 4, 5 }; var rightBlock = new byte[] { 1, 2, 3, 4, 5 }; var expectedDiffBlocks = new ClientSideDiffBlock { Offset = 2, Lenght = 1 }; // Act ClientSideDiffResult diffResultValue = await GetDiffAnalysisResponseWithSuccess(leftBlock, rightBlock); // Assert AssertDifferenceFounds(diffResultValue, expectedDiffBlocks); }