private void VerifyDestinationVersion(ConditionalUpdateResult updateResult, VersionedFileIdentityAndContentInfo originalDestinationInfo) { if (!updateResult.Elided) { XAssert.AreNotEqual( originalDestinationInfo.FileContentInfo.Hash, updateResult.DestinationInfo.FileContentInfo.Hash, "The copy / write should have changed the hash"); XAssert.AreNotEqual(originalDestinationInfo.FileContentInfo, updateResult.DestinationInfo.FileContentInfo); XAssert.AreNotEqual( originalDestinationInfo.Identity.ToWeakIdentity(), updateResult.DestinationInfo.Identity.ToWeakIdentity(), "Expected an identity change due to the copy"); XAssert.AreNotEqual(originalDestinationInfo, updateResult.DestinationInfo); } else { XAssert.AreEqual(originalDestinationInfo.FileContentInfo.Hash, updateResult.DestinationInfo.FileContentInfo.Hash); XAssert.AreEqual(originalDestinationInfo.FileContentInfo, updateResult.DestinationInfo.FileContentInfo); XAssert.AreEqual( originalDestinationInfo.Identity.ToWeakIdentity(), updateResult.DestinationInfo.Identity.ToWeakIdentity(), "Expected identity to stay the same due to copy / write elision"); } }
public void StubFileContentTableDoesNotThrowWhenRecording() { var table = FileContentTable.CreateStub(); WriteTestFiles(); VersionedFileIdentityAndContentInfo info = RecordContentHash(table, m_testFileA, s_hashA); AssertVerboseEventLogged(EventId.StorageFileContentTableIgnoringFileSinceVersionedFileIdentityIsNotSupported); XAssert.AreEqual(VersionedFileIdentity.IdentityKind.Anonymous, info.Identity.Kind); XAssert.IsTrue(info.Identity.IsAnonymous); }