コード例 #1
0
        /// <summary>Initializes a new instance of the <see cref="ClientGeneratorBaseSettings"/> class.</summary>
        protected ClientGeneratorBaseSettings()
        {
            GenerateClientClasses = true;
            GenerateDtoTypes      = true;

            OperationNameGenerator = new MultipleClientsFromOperationIdOperationNameGenerator();
            ParameterNameGenerator = new DefaultParameterNameGenerator();
        }
コード例 #2
0
        /// <summary>Initializes a new instance of the <see cref="ClientGeneratorBaseSettings"/> class.</summary>
        protected ClientGeneratorBaseSettings()
        {
            GenerateClientClasses = true;
            GenerateDtoTypes      = true;

            OperationNameGenerator = new MultipleClientsFromOperationIdOperationNameGenerator();
            ParameterNameGenerator = new DefaultParameterNameGenerator();

            GenerateResponseClasses = true;
            ResponseClass           = "SwaggerResponse";

            WrapResponseMethods = new string[0];
        }
コード例 #3
0
ファイル: CodeGenerationTests.cs プロジェクト: rwebrown/NSwag
        public void When_using_MultipleClientsFromOperationId_then_ensure_that_underscores_are_handled_as_expected(string operationId, string expectedClientName)
        {
            // Arrange
            var operation = new OpenApiOperation
            {
                OperationId = operationId
            };
            var generator = new MultipleClientsFromOperationIdOperationNameGenerator();

            // Arrange - "unused"
            // We don't need these values, because internally GetClientName only uses the operation
            // Use default values to prevent future exceptions when e.g. any null validation would be added
            var document   = new OpenApiDocument();
            var path       = string.Empty;
            var httpMethod = string.Empty;

            // Act
            string clientName = generator.GetClientName(document, path, httpMethod, operation);

            // Assert
            Assert.Equal(expectedClientName, clientName);
        }