Represents dependency on a file in a file system repository
Inheritance: Bari.Core.Build.Dependencies.DependenciesBase
        public void CreatesSameFingerprintForSameState()
        {
            var dep = new FSRepositoryReferenceDependencies(kernel.Get<IFSRepositoryFingerprintFactory>(), repository.Object, "test\\x");
            var fp1 = dep.CreateFingerprint();
            var fp2 = dep.CreateFingerprint();

            fp1.Should().Be(fp2);
            fp2.Should().Be(fp1);
        }
        public void CreatesSameFingerprintForSameState()
        {
            var dep1 = new FSRepositoryReferenceDependencies(kernel.Get<IFSRepositoryFingerprintFactory>(), repository.Object, Path.Combine("test", "x"));
            var dep2 = new FSRepositoryReferenceDependencies(kernel.Get<IFSRepositoryFingerprintFactory>(), repository.Object, Path.Combine("test", "x"));
            var fp1 = dep1.Fingerprint;
            var fp2 = dep2.Fingerprint;

            fp1.Should().Be(fp2);
            fp2.Should().Be(fp1);
        }
        public void ConvertToProtocolAndBack()
        {
            var dep = new FSRepositoryReferenceDependencies(kernel.Get<IFSRepositoryFingerprintFactory>(), repository.Object, Path.Combine("test", "x"));
            var fp1 = dep.Fingerprint;

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

            fp1.Should().Be(fp2);
        }
        public void ChangingTheSourceChangesTheFingerprint()
        {
            var dep = new FSRepositoryReferenceDependencies(kernel.Get<IFSRepositoryFingerprintFactory>(), repository.Object, "test\\x");
            var fp1 = dep.CreateFingerprint();

            depRoot.SetFileSize("x", 200);

            var fp2 = dep.CreateFingerprint();

            depRoot.SetFileSize("x", 11); // default
            depRoot.SetDate("x", DateTime.Now);

            var fp3 = dep.CreateFingerprint();

            fp1.Should().NotBe(fp2);
            fp1.Should().NotBe(fp3);
            fp2.Should().NotBe(fp3);
        }
        public void SerializeAndReadBack()
        {
            var ser = new BinarySerializer();
            var dep = new FSRepositoryReferenceDependencies(kernel.Get<IFSRepositoryFingerprintFactory>(), repository.Object, "test\\x");
            var fp1 = dep.CreateFingerprint();

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

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

            fp1.Should().Be(fp2);
        }
        public void SerializeAndReadBack()
        {
            var registry = new DependencyFingerprintProtocolRegistry();
            registry.Register<FSRepositoryFingerprintProtocol>();

            var ser = new BinarySerializer(registry);
            var dep = new FSRepositoryReferenceDependencies(kernel.Get<IFSRepositoryFingerprintFactory>(), repository.Object, Path.Combine("test", "x"));
            var fp1 = dep.Fingerprint;

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

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

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