コード例 #1
0
        public void StrongFingerprintVariations()
        {
            PathTable pathTable = new PathTable();

            AbsolutePath pathA = AbsolutePath.Create(pathTable, X("/X/bar"));
            AbsolutePath pathB = AbsolutePath.Create(pathTable, X("/X/foo"));

            WeakContentFingerprint wfp1 = new WeakContentFingerprint(CreateFakeFingerprint(1));
            WeakContentFingerprint wfp2 = new WeakContentFingerprint(CreateFakeFingerprint(2));

            ContentHash content1 = CreateFakeContentHash(3);
            ContentHash content2 = CreateFakeContentHash(4);

            FingerprintingHarness harness = new FingerprintingHarness(pathTable);

            // Initial
            harness.AssertFingerprintIsNew(
                wfp1,
                ObservedInput.CreateFileContentRead(pathA, content1));

            // Change WFP of Initial
            harness.AssertFingerprintIsNew(
                wfp2, // Changed
                ObservedInput.CreateFileContentRead(pathA, content1));

            // Change observation type of Initial
            harness.AssertFingerprintIsNew(
                wfp1,
                ObservedInput.CreateAbsentPathProbe(pathA)); // Changed
            harness.AssertFingerprintIsNew(
                wfp1,
                ObservedInput.CreateDirectoryEnumeration(pathA, new DirectoryFingerprint(content1))); // Changed

            // Change file content of Initial
            harness.AssertFingerprintIsNew(
                wfp1,
                ObservedInput.CreateFileContentRead(pathA, content2)); // Changed

            // Add a second file to Initial
            harness.AssertFingerprintIsNew(
                wfp1,
                ObservedInput.CreateFileContentRead(pathA, content1),
                ObservedInput.CreateFileContentRead(pathB, content1)); // New

            // Change WFP versus previous
            harness.AssertFingerprintIsNew(
                wfp2, // Changed
                ObservedInput.CreateFileContentRead(pathA, content1),
                ObservedInput.CreateFileContentRead(pathB, content1));

            harness.AssertFingerprintIsNew(
                wfp1,
                ObservedInput.CreateExistingDirectoryProbe(pathA)); // Changed
        }
コード例 #2
0
        public void ProjectPathSet()
        {
            var pathTable = new PathTable();

            AbsolutePath firstPath  = AbsolutePath.Create(pathTable, X("/X/bar"));
            AbsolutePath secondPath = AbsolutePath.Create(pathTable, X("/X/foo"));

            var p = CreateResult(
                pathTable,
                ObservedInput.CreateFileContentRead(firstPath, ContentHashingUtilities.EmptyHash),
                ObservedInput.CreateFileContentRead(secondPath, ContentHashingUtilities.EmptyHash));

            ObservedPathSet projected = p.GetPathSet(unsafeOptions: null);

            ObservedPathSetTestUtilities.AssertPathSetsEquivalent(
                projected,
                ObservedPathSetTestUtilities.CreatePathSet(pathTable, firstPath, secondPath));
        }