public void ShouldRecognizeSerializerAndDeserializerMethods()
        {
            var result = SnapshotDetector.CreateFor(typeof(ConverterClass));

            result.Serializers.Count().Should().Be(1);
            result.Deserializers.Count().Should().Be(1);
        }
        public void ShouldRecognizeDefaultSerializerAndDeserializerInHierarchy()
        {
            var result = SnapshotDetector.CreateFor(typeof(ExternalClass));

            result.Serializers.Count().Should().Be(2);
            result.Deserializers.Count().Should().Be(2);
        }
        public void ShouldRecognizeDefaultSerializerAndDeserializer()
        {
            var result = SnapshotDetector.CreateFor(typeof(InnerClass));

            result.Serializers.Count().Should().Be(1);
            result.Deserializers.Count().Should().Be(1);
        }
Beispiel #4
0
        /// <summary>
        /// Creates a snapshot from the given types.
        /// </summary>
        /// <param name="snapshotName">Name of the snapshot.</param>
        /// <param name="knownTypes">List of types to examine (all roots of serializable object hierarchies).</param>
        /// <returns>The snapshot taken.</returns>
        public static Snapshot Create(string snapshotName, IEnumerable <Type> knownTypes)
        {
            SnapshotDetector builder = SnapshotDetector.CreateFor(null, knownTypes);

            return(new Snapshot(snapshotName, builder.Serializers, builder.Deserializers));
        }
Beispiel #5
0
        /// <summary>
        /// Creates a snapshot from the given assemblies by searching for all serializable object graph roots marked by the <see cref="ShapeshifterRootAttribute"/>.
        /// </summary>
        /// <param name="snapshotName">Name of the snapshot.</param>
        /// <param name="assembliesInScope">List of input assemblies.</param>
        /// <returns>The snapshot taken.</returns>
        public static Snapshot Create(string snapshotName, IEnumerable <Assembly> assembliesInScope)
        {
            SnapshotDetector builder = SnapshotDetector.CreateFor(assembliesInScope);

            return(new Snapshot(snapshotName, builder.Serializers, builder.Deserializers));
        }