Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web api contract first as abstract controllers #1

Merged
merged 8 commits into from
Aug 16, 2017

Conversation

gozdebozkurt
Copy link
Collaborator

WrapResponses bugfix - using System.Net.Http carried on FileTemplate
New futures added GenerateControllerInterfaces and GenerateAbstractController in SwaggerToCSharpControllerCommand and SwaggerToCSharpController

Gozde Ozdemir added 3 commits August 14, 2017 10:04
…nd GenerateAbstractController setting is added + created new test classes
…faces and GenerateAbstractController setting is added
var code = codeGen.GenerateFile();

//// Assert
Assert.IsTrue(code.Contains("abstract class TestController"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be Assert.IsFalse(code.Contains("abstract class TestController"));

//// Act
var codeGen = new SwaggerToCSharpClientGenerator(document, new SwaggerToCSharpClientGeneratorSettings
{
GenerateControllerInterfaces = true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are testing only the abstract controller setting here I would keep GenerateControllerInterfaces = false


//// Assert
Assert.IsTrue(code.Contains("abstract class TestController"));
Assert.IsTrue(code.Contains("abstract Foo"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one also should be false

<# if (Model.WrapResponses){#>
var result = await _implementation.<#=operation.ActualOperationName#>Async(<#foreach(var parameter in operation.Parameters){#><#=parameter.VariableName#><#if(!parameter.IsLast){#>, <#}}#>);
var result = await _implementation.<#=operation.ActualOperationName#>Async(<#foreach(var parameter in operation.Parameters){#><#=parameter.VariableName#><# if(!parameter.IsLast){#>, <#}}#>);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably revert formatting changes on this line and on lines 48 and 55 as well

@gozdebozkurt gozdebozkurt requested a review from ma499 August 14, 2017 15:35
@gozdebozkurt gozdebozkurt requested a review from GiampaLab August 15, 2017 08:56
…are deleted. ControllerGenerationFormat parameter is added. (default:partial)Test classes are deleted and new test class is added.
Copy link

@ma499 ma499 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@gozdebozkurt gozdebozkurt merged commit 8ef118e into master Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants