Represents dependency on a full SourceSet
상속: DependenciesBase
예제 #1
0
        public void CreatesSameFingerprintForSameState()
        {
            var dep = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp1 = dep.CreateFingerprint();
            var fp2 = dep.CreateFingerprint();

            fp1.Should().Be(fp2);
            fp2.Should().Be(fp1);
        }
예제 #2
0
        public void ConvertToProtocolAndBack()
        {
            var dep = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp1 = dep.Fingerprint;

            var proto = fp1.Protocol;
            var fp2 = proto.CreateFingerprint();

            fp1.Should().Be(fp2);
        }
예제 #3
0
        public void RemovingFileChangesFingerprint()
        {
            var dep = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp1 = dep.CreateFingerprint();

            File.Delete(Path.Combine(tmp, "file1"));
            sourceSet.Remove(new SuiteRelativePath("file1"));

            var fp2 = dep.CreateFingerprint();

            fp1.Should().NotBe(fp2);
        }
예제 #4
0
        public void AddingFileChangesFingerprint()
        {
            var dep1 = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp1 = dep1.Fingerprint;

            using (var writer = rootDir.CreateTextFile("file3"))
                writer.WriteLine("Contents of file 3");
            sourceSet.Add(new SuiteRelativePath("file3"));

            var dep2 = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp2 = dep2.Fingerprint;

            fp1.Should().NotBe(fp2);
        }
예제 #5
0
        public void AddingFileToSubdirectoryChangesFingerprint()
        {
            var dep1 = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp1 = dep1.Fingerprint;

            Directory.CreateDirectory(Path.Combine(tmp, "subdir"));
            using (var writer = rootDir.GetChildDirectory("subdir").CreateTextFile("file3"))
                writer.WriteLine("Contents of file 3");
            sourceSet.Add(new SuiteRelativePath(Path.Combine("subdir", "file3")));

            var dep2 = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp2 = dep2.Fingerprint;

            fp1.Should().NotBe(fp2);
        }
예제 #6
0
        public void ModifyingFileChangesFingerprint()
        {
            var dep1 = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp1 = dep1.Fingerprint;

            using (var writer = File.CreateText(Path.Combine(tmp, "file2")))
            {
                writer.WriteLine("Modified contents");
                writer.Flush();
            }

            RebindRootDir();

            var dep2 = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp2 = dep2.Fingerprint;

            fp1.Should().NotBe(fp2);
        }
예제 #7
0
        public void SerializeAndReadBack()
        {
            var registry = new DependencyFingerprintProtocolRegistry();
            registry.Register<SourceSetFingerprintProtocol>();

            var ser = new BinarySerializer(registry);
            var dep = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp1 = dep.Fingerprint;

            byte[] data;
            using (var ms = new MemoryStream())
            {
                fp1.Save(ser, ms);
                data = ms.ToArray();
            }

            SourceSetFingerprint fp2;
            using (var ms = new MemoryStream(data))
            {
                fp2 = new SourceSetFingerprint(ser, ms);
            }

            fp1.Should().Be(fp2);
        }
예제 #8
0
        public void SerializeAndReadBack()
        {
            var ser = new BinarySerializer();
            var dep = new SourceSetDependencies(fingerprintFactory, sourceSet);
            var fp1 = dep.CreateFingerprint();

            byte[] data;
            using (var ms = new MemoryStream())
            {
                fp1.Save(ser, ms);
                data = ms.ToArray();
            }

            SourceSetFingerprint fp2;
            using (var ms = new MemoryStream(data))
            {
                fp2 = new SourceSetFingerprint(ser, ms);
            }            

            fp1.Should().Be(fp2);
        }