private static IIdentifierXmlMarhsaller <PersonIdentifier, IdentifierDefinition> CreateMarshallerFor(IdentifierDefinition identifierDefinition) { var marshallerCreator = new IdentifierXmlMarshallerCreator <PersonIdentifier, IdentifierDefinition>(); identifierDefinition.Accept(marshallerCreator); return(marshallerCreator.Marshallers.Values.Single()); }
public static IIdentifierXmlMarhsaller <PersonIdentifier, IdentifierDefinition> CreateXmlMarshaller(this IdentifierDefinition definition) { var creator = new IdentifierXmlMarshallerCreator <PersonIdentifier, IdentifierDefinition>(); definition.Accept(creator); return(creator.Marshallers.Values.Single()); }
public void CreatesStringIdentifierMarshaller(IDefinitionType type) { var identifierDefinition = new IdentifierDefinition("test", type); var creator = new IdentifierXmlMarshallerCreator <PersonIdentifier, IdentifierDefinition>(); identifierDefinition.Accept(creator); Assert.Contains("test", creator.Marshallers.Keys); var marshaller = creator.Marshallers["test"]; var stringMarshaller = Assert.IsType <IdentifierXmlElementMarshaller <PersonIdentifier, IdentifierDefinition> >(marshaller); Assert.Equal(identifierDefinition, stringMarshaller.Definition); }