Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
        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);
        }