Exemplo n.º 1
0
        public async Task Should_retrieve_swagger_information()
        {
            var retriever = new SwaggerRetriever(new TestApiMetadataConfiguration(_configuration));
            var result    = await retriever.LoadMetadata();

            Assert.AreNotEqual(0, result.Count);
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            var retriever = new SwaggerRetriever(JsonMetadataTests.ApiMetadataConfiguration);

            var metadataRetriever = new SwaggerMetadataRetriever(
                JsonMetadataTests.ApiMetadataConfiguration, retriever,
                new List <string>());

            var jfactory = new JsonMetadataFactory(metadataRetriever);

            _jsonMetadata = jfactory.GetMetadata().ToList();

            var ssbuilder = new SchemaSetFactory(new XsdStreamsRetriever(JsonMetadataTests.XmlMetadataConfiguration));
            var xfactory  = new XsdMetadataFactory(ssbuilder.GetSchemaSet());

            _xmlMetadata = xfactory.GetMetadata().ToList();

            var strategies = new List <IMetadataMapper>
            {
                //new DiminishingMetadataMapper(),
                new PremappedLookupMetadataMapper(), new LookupDoNotMapPropertyMapper(),

                //new ArrayMetadataMapper(),
                new DescriptorReferenceMetadataMapper(), new NameMatchingMetadataMapper()

                //new SchoolIdBugFixMetadataMapper()
            };

            var factory = new LookupToGetByExampleMetadataMappingFactory(_xmlMetadata, _jsonMetadata, strategies);

            _mappings = factory.GetMetadataMappings().ToArray();
        }
        public void SetUp()
        {
            var retriever = new SwaggerRetriever(JsonMetadataTests.ApiMetadataConfiguration);

            var metadataRetriever = new SwaggerMetadataRetriever(
                JsonMetadataTests.ApiMetadataConfiguration, retriever,
                new List <string>());

            var ssbuilder = new SchemaSetFactory(new XsdStreamsRetriever(JsonMetadataTests.XmlMetadataConfiguration));
            var xfactory  = new XsdApiTypesMetadataFactory(ssbuilder.GetSchemaSet());

            _xmlMetadata = xfactory.GetMetadata().ToList();

            var jfactory = new JsonMetadataFactory(metadataRetriever);

            _jsonMetadata = jfactory.GetMetadata().ToList();

            var strategies = new IMetadataMapper[]
            {
                new ArrayMetadataMapper(), new DescriptorReferenceMetadataMapper(), new NameMatchingMetadataMapper()
            };

            var factory = new ResourceToResourceMetadataMappingFactory(
                _xmlMetadata.AsEnumerable(),
                _jsonMetadata.AsEnumerable(), strategies);

            _mappings = factory.GetMetadataMappings().ToArray();
        }
 public GetSwaggerMetadataGenerator(
     SwaggerRetriever retriever,
     Dictionary <string, Resource> resources,
     List <string> schemaNames,
     Dictionary <string, SwaggerDocument> swaggerDocuments,
     Dictionary <string, Entity> entities)
 {
     _retriever        = retriever;
     _resources        = resources;
     _schemaNames      = schemaNames;
     _swaggerDocuments = swaggerDocuments;
     _entities         = entities;
 }