public void CanAddDocumentSpecByName()
      {
         PipelineContext context = new PipelineContext();
         DocSpecLoader loader = new DocSpecLoader();
         context.AddDocSpecByName("spec1", loader.LoadDocSpec(typeof(Schema1_NPP)));

         Assert.IsNotNull(context.GetDocumentSpecByName("spec1"));
      }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a new document specification to the list
        /// of Known Schemas for this pipeline.
        /// </summary>
        /// <remarks>
        /// Adding known schemas is necessary so that
        /// document type resolution works in the disassembler/assembler
        /// stages. Notice that this overload does NOT do automatic checking
        /// for multiple roots.
        /// </remarks>
        /// <param name="typeName">The fully qualified (namespace.class) name of
        /// the schema</param>
        /// <param name="assemblyName">The partial or full name of the assembly
        /// containing the schema</param>
        public void AddDocSpec(string typeName, string assemblyName)
        {
            if (String.IsNullOrEmpty(typeName))
            {
                throw new ArgumentNullException("typeName");
            }
            if (String.IsNullOrEmpty(assemblyName))
            {
                throw new ArgumentNullException("assemblyName");
            }

            DocSpecLoader loader = new DocSpecLoader();
            IDocumentSpec spec   = loader.LoadDocSpec(typeName, assemblyName);

            AddDocSpecToContext(spec);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds a new document specification to the list
        /// of Known Schemas for this pipeline.
        /// </summary>
        /// <remarks>
        /// Adding known schemas is necessary so that
        /// document type resolution works in the disassembler/assembler
        /// stages
        /// </remarks>
        /// <param name="schemaType">Type of the document schema to add</param>
        public void AddDocSpec(Type schemaType)
        {
            if (schemaType == null)
            {
                throw new ArgumentNullException("schemaType");
            }

            DocSpecLoader loader = new DocSpecLoader();

            Type[] roots = GetSchemaRoots(schemaType);
            foreach (Type root in roots)
            {
                IDocumentSpec docSpec = loader.LoadDocSpec(root);
                AddDocSpecToContext(docSpec);
            }
        }
 public void CanLoadDocSpecWithPromotedProperties()
 {
    DocSpecLoader loader = new DocSpecLoader();
    IDocumentSpec docSpec = loader.LoadDocSpec(typeof(Schema2_WPP));
    Assert.IsNotNull(docSpec);
 }
 public void ThrowExceptionWhenDocSpecIsInvalidType()
 {
    DocSpecLoader loader = new DocSpecLoader();
    loader.LoadDocSpec(typeof(string));
 }
 public void ThrowExceptionWhenDocSpecIsNull()
 {
    DocSpecLoader loader = new DocSpecLoader();
    loader.LoadDocSpec(null);
 }