Exemple #1
0
        private ModelDescription GenerateSimpleTypeModelDescription(Type modelType)
        {
            SimpleTypeModelDescription simpleModelDescription = new SimpleTypeModelDescription
            {
                Name          = ModelNameHelper.GetModelName(modelType),
                ModelType     = modelType,
                Documentation = CreateDefaultDocumentation(modelType)
            };

            GeneratedModels.Add(simpleModelDescription.Name, simpleModelDescription);

            return(simpleModelDescription);
        }
Exemple #2
0
        public void CreateModelDescription_SimpleTypes(
            Type type,
            string expectedModelName,
            string expectedDocumentation
            )
        {
            HttpConfiguration         config         = new HttpConfiguration();
            ModelDescriptionGenerator modelGenerator = new ModelDescriptionGenerator(config);

            SimpleTypeModelDescription simpleModel = Assert.IsType <SimpleTypeModelDescription>(
                modelGenerator.GetOrCreateModelDescription(type)
                );

            Assert.NotNull(simpleModel);
            Assert.Equal(expectedModelName, simpleModel.Name);
            Assert.Equal(type, simpleModel.ModelType);
            Assert.Equal(expectedDocumentation, simpleModel.Documentation);
        }
        private ModelDescription GenerateSimpleTypeModelDescription(Type modelType)
        {
            SimpleTypeModelDescription simpleModelDescription = new SimpleTypeModelDescription
            {
                Name = ModelNameHelper.GetModelName(modelType),
                ModelType = modelType,
                Documentation = CreateDefaultDocumentation(modelType)
            };
            GeneratedModels.Add(simpleModelDescription.Name, simpleModelDescription);

            return simpleModelDescription;
        }