private async Task VerifyWriteBytesIfContentMismatchedAsync(
            FileContentTable fileContentTable,
            string targetRelPath,
            string contents,
            bool expectWrite,
            VersionedFileIdentityAndContentInfo?originalDestinationInfo = null)
        {
            byte[]                  encoded      = Encoding.UTF8.GetBytes(contents);
            ContentHash             contentsHash = ContentHashingUtilities.HashBytes(encoded);
            ConditionalUpdateResult result       =
                await fileContentTable.WriteBytesIfContentMismatchedAsync(GetFullPath(targetRelPath), encoded, contentsHash);

            XAssert.AreEqual(expectWrite, !result.Elided, "Decision to write was incorrect.");

            FileContentTableExtensions.VersionedFileIdentityAndContentInfoWithOrigin targetInfo =
                await fileContentTable.GetAndRecordContentHashAsync(GetFullPath(targetRelPath));

            XAssert.AreEqual(FileContentTableExtensions.ContentHashOrigin.Cached, targetInfo.Origin, "Write didn't record the target hash.");
            XAssert.AreEqual(
                contentsHash,
                targetInfo.VersionedFileIdentityAndContentInfo.FileContentInfo.Hash,
                "Hashes should match after the write.");
            XAssert.AreEqual(contents, File.ReadAllText(GetFullPath(targetRelPath)), "Hashes match but content does not");

            if (originalDestinationInfo.HasValue)
            {
                VerifyDestinationVersion(result, originalDestinationInfo.Value);
            }
        }