-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug where nullable enum like classes could not be deserialize…
…d correctly (#564) * Fixed a bug where nullable enum like classes could not be deserialized correctly * Updated sample project version * Added test for null cases as well
- Loading branch information
1 parent
1b6788d
commit 5d71f00
Showing
3 changed files
with
42 additions
and
4 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
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,36 @@ | ||
using System; | ||
using FluentAssertions; | ||
using OmniSharp.Extensions.DebugAdapter.Client; | ||
using OmniSharp.Extensions.DebugAdapter.Protocol; | ||
using OmniSharp.Extensions.DebugAdapter.Protocol.Models; | ||
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; | ||
using Xunit; | ||
|
||
namespace Dap.Tests | ||
{ | ||
public class EnumLikeConverterTests | ||
{ | ||
[Fact] | ||
public void PathFormat_Should_Be_Serializable() | ||
{ | ||
var options = new InitializeRequestArguments() { | ||
PathFormat = PathFormat.Uri | ||
}; | ||
|
||
Action a = () => new DapSerializer().SerializeObject(options); | ||
a.Should().NotThrow(); | ||
} | ||
[Fact] | ||
public void PathFormat_Should_Be_Deserializable() | ||
{ | ||
Func<InitializeRequestArguments> a = () => new DapSerializer().DeserializeObject<InitializeRequestArguments>("{\"pathformat\": \"Uri\"}"); | ||
a.Should().NotThrow().Subject.PathFormat.Should().NotBeNull(); | ||
} | ||
[Fact] | ||
public void PathFormat_Should_Be_Deserializable_When_Null() | ||
{ | ||
var a = new DapSerializer().DeserializeObject<InitializeRequestArguments>("{\"pathformat\":null}"); | ||
a.PathFormat.Should().BeNull(); | ||
} | ||
} | ||
} |