コード例 #1
0
        public void ShouldRecognizeSerializerAndDeserializerMethods()
        {
            var result = SnapshotDetector.CreateFor(typeof(ConverterClass));

            result.Serializers.Count().Should().Be(1);
            result.Deserializers.Count().Should().Be(1);
        }
コード例 #2
0
        public void ShouldRecognizeDefaultSerializerAndDeserializerInHierarchy()
        {
            var result = SnapshotDetector.CreateFor(typeof(ExternalClass));

            result.Serializers.Count().Should().Be(2);
            result.Deserializers.Count().Should().Be(2);
        }
コード例 #3
0
        public void ShouldRecognizeDefaultSerializerAndDeserializer()
        {
            var result = SnapshotDetector.CreateFor(typeof(InnerClass));

            result.Serializers.Count().Should().Be(1);
            result.Deserializers.Count().Should().Be(1);
        }
コード例 #4
0
ファイル: Snapshot.cs プロジェクト: realvizu/shapeshifter
        /// <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));
        }
コード例 #5
0
ファイル: Snapshot.cs プロジェクト: realvizu/shapeshifter
        /// <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));
        }