Skip to content

Commit

Permalink
Extend return type override unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Haberecht committed Jan 11, 2024
1 parent e15083d commit 29f2775
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Refitter.Tests/SwaggerPetstoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,17 @@ public async Task Can_Generate_Code_With_Type_Override(SampleOpenSpecifications
var settings = new RefitGeneratorSettings
{
ReturnIApiResponse = false,
ResponseTypeOverride = { ["getPetById"] = "IApiResponse<Pet>" },
ResponseTypeOverride =
{
["getPetById"] = "IApiResponse<Pet>", // Wrap existing type
["deletePet"] = "Pet", // Add type where there was none
["addPet"] = "void", // Remove type
},
};
var generateCode = await GenerateCode(version, filename, settings);
generateCode.Should().Contain("Task<IApiResponse<Pet>>", Exactly.Once());
generateCode.Should().Contain("Task<IApiResponse<Pet>> GetPetById");
generateCode.Should().Contain("Task<Pet> DeletePet");
generateCode.Should().Contain("Task AddPet");
}

[Theory]
Expand Down

0 comments on commit 29f2775

Please sign in to comment.