-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
98 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
tests/Kiota.Builder.Tests/Writers/HTTP/HttpConventionServiceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
using Kiota.Builder.CodeDOM; | ||
using Kiota.Builder.Writers; | ||
using Kiota.Builder.Writers.Http; | ||
using Xunit; | ||
|
||
namespace Kiota.Builder.Tests.Writers.Http; | ||
public sealed class HttpConventionServiceTest | ||
{ | ||
|
||
[Fact] | ||
public void TestGetDefaultValueForProperty_Int() | ||
{ | ||
// Arrange | ||
var codeProperty = new CodeProperty | ||
{ | ||
Type = new CodeType { Name = "int" } | ||
}; | ||
|
||
// Act | ||
var result = HttpConventionService.GetDefaultValueForProperty(codeProperty); | ||
|
||
// Assert | ||
Assert.Equal("0", result); | ||
} | ||
|
||
[Fact] | ||
public void TestGetDefaultValueForProperty_String() | ||
{ | ||
// Arrange | ||
var codeProperty = new CodeProperty | ||
{ | ||
Type = new CodeType { Name = "string" } | ||
}; | ||
|
||
// Act | ||
var result = HttpConventionService.GetDefaultValueForProperty(codeProperty); | ||
|
||
// Assert | ||
Assert.Equal("\"string\"", result); | ||
} | ||
|
||
[Fact] | ||
public void TestGetDefaultValueForProperty_Bool() | ||
{ | ||
// Arrange | ||
var codeProperty = new CodeProperty | ||
{ | ||
Type = new CodeType { Name = "bool" } | ||
}; | ||
|
||
// Act | ||
var result = HttpConventionService.GetDefaultValueForProperty(codeProperty); | ||
|
||
// Assert | ||
Assert.Equal("false", result); | ||
} | ||
|
||
[Fact] | ||
public void TestGetDefaultValueForProperty_Null() | ||
{ | ||
// Arrange | ||
var codeProperty = new CodeProperty | ||
{ | ||
Type = new CodeType { Name = "unknown" } | ||
}; | ||
|
||
// Act | ||
var result = HttpConventionService.GetDefaultValueForProperty(codeProperty); | ||
|
||
// Assert | ||
Assert.Equal("null", result); | ||
} | ||
} |