public void Test_Building_A_Tree_For_A_Null_Type() { Action action = () => TreeBuilder.BuildTreeForType(null); action.Should() .ThrowArgumentNullException("type"); }
private static void BadTypeExceptionShouldBeThrownForType <T>(string message) { Action action = () => TreeBuilder.BuildTreeForType(typeof(T)); action.Should() .ThrowExactly <BadTypeException>() .WithMessage(message) .Where(e => typeof(T) == e.Type); }
/// <summary> /// Builds a binary serializer for type <typeparamref name="T"/>. /// </summary> /// /// <typeparam name="T">The type for the binary serializer.</typeparam> /// /// <returns>A binary serializer for type <typeparamref name="T"/>.</returns> public static IBinarySerializer <T> ForType <T>() { return(new TreeBinarySerializer <T>( treeReader: treeReader.Read, treeWriter: WriteTree, rootNode: TreeBuilder.BuildTreeForType(typeof(T)), footerAligner: AlignFooter )); }
public void Test_Building_A_Tree_For_A_Class_With_A_List_With_Duplicated_Entry_Count() { IDataNode rootNode = TreeBuilder.BuildTreeForType(typeof(ClassWithAListWithDuplicatedEntryCount)); VerifyTreeForClassWithAList( dataNode: rootNode, expected: new ClassWithAListWithDuplicatedEntryCount { Values = new List <ClassWithPrimitiveProperties>() }, extractor: v => v.Values, duplicateEntryCount: true ); }
public void Test_Building_A_Tree_For_A_Class_With_Nested_Class_With_Primitive_Properties() { IDataNode rootNode = TreeBuilder.BuildTreeForType(typeof(ClassWithNestedClassWithPrimitiveProperties)); ClassWithNestedClassWithPrimitiveProperties.BuildSample().VerifyTree(rootNode); }
public void Test_Building_A_Tree_For_A_Class_With_A_String_Inline() { IDataNode rootNode = TreeBuilder.BuildTreeForType(typeof(ClassWithStringInline)); ClassWithStringInline.BuildSample().VerifyTree(rootNode); }
public void Test_Building_A_Tree_For_A_Class_With_A_String_At_Offset() { IDataNode rootNode = TreeBuilder.BuildTreeForType(typeof(ClassWithStringAtOffset)); ClassWithStringAtOffset.BuildSample().VerifyTree(rootNode); }