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

Fix #12431 - [CSHARP] update testFolder when setting sourceFolder #12432

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ public void processOpts() {
// {{sourceFolder}}
if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) {
setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
// By default, the test folder shares the same path as the source folder.
// Therefore, both are updated when setting the source folder.
setTestFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
} else {
additionalProperties.put(CodegenConstants.SOURCE_FOLDER, this.sourceFolder);
}
Expand Down Expand Up @@ -925,6 +928,10 @@ public void setSourceFolder(String sourceFolder) {
this.sourceFolder = sourceFolder;
}

public void setTestFolder(String testFolder) {
this.testFolder = testFolder;
}

public String getInterfacePrefix() {
return interfacePrefix;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.languages.CSharpClientCodegen;

import java.io.File;

public class CSharpClientCodegenTest {

@Test
Expand Down Expand Up @@ -37,4 +39,20 @@ public void testAdditionalPropertiesPutForConfigValues() throws Exception {
Assert.assertEquals(codegen.isHideGenerationTimestamp(), false);
}

@Test(description = "TEST_FOLDER should be updated with SOURCE_FOLDER when SOURCE_FOLDER is set")
public void testAdditionalPropertiesPutForSourceFolder() throws Exception {
final CSharpClientCodegen codegen = new CSharpClientCodegen();

final String expectedSourceFolder = "CustomSourceFolder";

codegen.additionalProperties().put(CodegenConstants.SOURCE_FOLDER, expectedSourceFolder);
codegen.processOpts();

final String expectedTestFolder = codegen.outputFolder() + File.separator + expectedSourceFolder;

Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.SOURCE_FOLDER), expectedSourceFolder);
Assert.assertTrue(codegen.apiTestFileFolder().startsWith(expectedTestFolder));
Assert.assertTrue(codegen.modelTestFileFolder().startsWith(expectedTestFolder));
}

}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.0-SNAPSHOT
2.4.42-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.19-SNAPSHOT
2.4.42-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.19-SNAPSHOT
2.4.42-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.19-SNAPSHOT
2.4.42-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.3-SNAPSHOT
2.4.42-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -118,35 +118,35 @@ Class | Method | HTTP request | Description
- [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Model.ArrayTest](docs/ArrayTest.md)
- [Model.Boolean](docs/Boolean.md)
- [Model.Capitalization](docs/Capitalization.md)
- [Model.Cat](docs/Cat.md)
- [Model.Category](docs/Category.md)
- [Model.ClassModel](docs/ClassModel.md)
- [Model.Dog](docs/Dog.md)
- [Model.EnumArrays](docs/EnumArrays.md)
- [Model.EnumClass](docs/EnumClass.md)
- [Model.EnumTest](docs/EnumTest.md)
- [Model.FormatTest](docs/FormatTest.md)
- [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [Model.Ints](docs/Ints.md)
- [Model.List](docs/List.md)
- [Model.MapTest](docs/MapTest.md)
- [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model.Model200Response](docs/Model200Response.md)
- [Model.ModelClient](docs/ModelClient.md)
- [Model.Name](docs/Name.md)
- [Model.NumberOnly](docs/NumberOnly.md)
- [Model.Numbers](docs/Numbers.md)
- [Model.Order](docs/Order.md)
- [Model.OuterBoolean](docs/OuterBoolean.md)
- [Model.OuterComposite](docs/OuterComposite.md)
- [Model.OuterEnum](docs/OuterEnum.md)
- [Model.OuterNumber](docs/OuterNumber.md)
- [Model.OuterString](docs/OuterString.md)
- [Model.Pet](docs/Pet.md)
- [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Model.Return](docs/Return.md)
- [Model.SpecialModelName](docs/SpecialModelName.md)
- [Model.Tag](docs/Tag.md)
- [Model.User](docs/User.md)
- [Model.Cat](docs/Cat.md)
- [Model.Dog](docs/Dog.md)


<a name="documentation-for-authorization"></a>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# IO.Swagger.Model.Boolean
## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Method | HTTP request | Description

<a name="fakeouterbooleanserialize"></a>
# **FakeOuterBooleanSerialize**
> OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null)
> bool? FakeOuterBooleanSerialize (bool? body = null)



Expand All @@ -39,11 +39,11 @@ namespace Example
public void main()
{
var apiInstance = new FakeApi();
var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional)
var body = new bool?(); // bool? | Input boolean as post body (optional)

try
{
OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body);
bool? result = apiInstance.FakeOuterBooleanSerialize(body);
Debug.WriteLine(result);
}
catch (Exception e)
Expand All @@ -59,11 +59,11 @@ namespace Example

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional]
**body** | [**bool?**](bool?.md)| Input boolean as post body | [optional]

### Return type

[**OuterBoolean**](OuterBoolean.md)
**bool?**

### Authorization

Expand Down Expand Up @@ -138,7 +138,7 @@ No authorization required

<a name="fakeouternumberserialize"></a>
# **FakeOuterNumberSerialize**
> OuterNumber FakeOuterNumberSerialize (OuterNumber body = null)
> decimal? FakeOuterNumberSerialize (decimal? body = null)



Expand All @@ -159,11 +159,11 @@ namespace Example
public void main()
{
var apiInstance = new FakeApi();
var body = new OuterNumber(); // OuterNumber | Input number as post body (optional)
var body = new decimal?(); // decimal? | Input number as post body (optional)

try
{
OuterNumber result = apiInstance.FakeOuterNumberSerialize(body);
decimal? result = apiInstance.FakeOuterNumberSerialize(body);
Debug.WriteLine(result);
}
catch (Exception e)
Expand All @@ -179,11 +179,11 @@ namespace Example

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional]
**body** | [**decimal?**](decimal?.md)| Input number as post body | [optional]

### Return type

[**OuterNumber**](OuterNumber.md)
**decimal?**

### Authorization

Expand All @@ -198,7 +198,7 @@ No authorization required

<a name="fakeouterstringserialize"></a>
# **FakeOuterStringSerialize**
> OuterString FakeOuterStringSerialize (OuterString body = null)
> string FakeOuterStringSerialize (string body = null)



Expand All @@ -219,11 +219,11 @@ namespace Example
public void main()
{
var apiInstance = new FakeApi();
var body = new OuterString(); // OuterString | Input string as post body (optional)
var body = new string(); // string | Input string as post body (optional)

try
{
OuterString result = apiInstance.FakeOuterStringSerialize(body);
string result = apiInstance.FakeOuterStringSerialize(body);
Debug.WriteLine(result);
}
catch (Exception e)
Expand All @@ -239,11 +239,11 @@ namespace Example

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OuterString**](OuterString.md)| Input string as post body | [optional]
**body** | [**string**](string.md)| Input string as post body | [optional]

### Return type

[**OuterString**](OuterString.md)
**string**

### Authorization

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# IO.Swagger.Model.Ints
## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# IO.Swagger.Model.Numbers
## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MyNumber** | [**OuterNumber**](OuterNumber.md) | | [optional]
**MyString** | [**OuterString**](OuterString.md) | | [optional]
**MyBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional]
**MyNumber** | **decimal?** | | [optional]
**MyString** | **string** | | [optional]
**MyBoolean** | **bool?** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void (empty response body)

<a name="uploadfile"></a>
# **UploadFile**
> ApiResponse UploadFile (long? petId, string additionalMetadata = null, System.IO.Stream file = null)
> ApiResponse UploadFile (long? petId, string additionalMetadata = null, System.IO.Stream _file = null)

uploads an image

Expand All @@ -484,12 +484,12 @@ namespace Example
var apiInstance = new PetApi();
var petId = 789; // long? | ID of pet to update
var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional)
var file = new System.IO.Stream(); // System.IO.Stream | file to upload (optional)
var _file = new System.IO.Stream(); // System.IO.Stream | file to upload (optional)

try
{
// uploads an image
ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file);
ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, _file);
Debug.WriteLine(result);
}
catch (Exception e)
Expand All @@ -507,7 +507,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| ID of pet to update |
**additionalMetadata** | **string**| Additional data to pass to server | [optional]
**file** | **System.IO.Stream**| file to upload | [optional]
**_file** | **System.IO.Stream**| file to upload | [optional]

### Return type

Expand Down
Loading