private async Task VerifyCopyIfContentMismatchedAsync( FileContentTable fileContentTable, string sourceRelPath, string destRelPath, FileContentInfo sourceVersionedHash, bool expectedCopy, VersionedFileIdentityAndContentInfo?originalDestinationInfo = null) { ConditionalUpdateResult result = await fileContentTable.CopyIfContentMismatchedAsync(GetFullPath(sourceRelPath), GetFullPath(destRelPath), sourceVersionedHash); XAssert.AreEqual(expectedCopy, !result.Elided, "Decision to copy or elide was incorrect."); FileContentTableExtensions.VersionedFileIdentityAndContentInfoWithOrigin targetInfo = await fileContentTable.GetAndRecordContentHashAsync(GetFullPath(destRelPath)); XAssert.AreEqual(FileContentTableExtensions.ContentHashOrigin.Cached, targetInfo.Origin, "Copy didn't record the target hash."); XAssert.AreEqual( sourceVersionedHash.Hash, targetInfo.VersionedFileIdentityAndContentInfo.FileContentInfo.Hash, "Hashes should match after the copy."); XAssert.AreEqual( File.ReadAllText(GetFullPath(sourceRelPath)), File.ReadAllText(GetFullPath(destRelPath)), "Hashes match but content does not"); if (originalDestinationInfo.HasValue) { VerifyDestinationVersion(result, originalDestinationInfo.Value); } }