Represents dependency on a full SourceSet
Inheritance: 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);
        }