Skip to content

Commit b27094e

Browse files
committed
tests
1 parent 6287e81 commit b27094e

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

tests/CommandQuery.Tests/Client/CommandClientTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using System.Text;
2+
using System.Text.Json;
23
using CommandQuery.Client;
34
using CommandQuery.Sample.Contracts.Commands;
45
using FluentAssertions;
56
using Moq.Protected;
6-
using Newtonsoft.Json;
77

88
namespace CommandQuery.Tests.Client
99
{
@@ -54,7 +54,7 @@ public async Task PostAsync_with_result()
5454
var httpResponse = new HttpResponseMessage
5555
{
5656
StatusCode = System.Net.HttpStatusCode.OK,
57-
Content = new StringContent(JsonConvert.SerializeObject(expectation), Encoding.UTF8, "application/json")
57+
Content = new StringContent(JsonSerializer.Serialize(expectation), Encoding.UTF8, "application/json")
5858
};
5959

6060
MockHandler.Protected().Setup<Task<HttpResponseMessage>>("SendAsync",

tests/CommandQuery.Tests/Client/QueryClientTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using System.Text;
2+
using System.Text.Json;
23
using CommandQuery.Client;
34
using CommandQuery.Sample.Contracts.Queries;
45
using FluentAssertions;
56
using Moq.Protected;
6-
using Newtonsoft.Json;
77

88
namespace CommandQuery.Tests.Client
99
{
@@ -36,7 +36,7 @@ public async Task PostAsync()
3636
var httpResponse = new HttpResponseMessage
3737
{
3838
StatusCode = System.Net.HttpStatusCode.OK,
39-
Content = new StringContent(JsonConvert.SerializeObject(expectation), Encoding.UTF8, "application/json")
39+
Content = new StringContent(JsonSerializer.Serialize(expectation), Encoding.UTF8, "application/json")
4040
};
4141

4242
MockHandler.Protected().Setup<Task<HttpResponseMessage>>("SendAsync",
@@ -57,7 +57,7 @@ public async Task GetAsync()
5757
var httpResponse = new HttpResponseMessage
5858
{
5959
StatusCode = System.Net.HttpStatusCode.OK,
60-
Content = new StringContent(JsonConvert.SerializeObject(expectation), Encoding.UTF8, "application/json")
60+
Content = new StringContent(JsonSerializer.Serialize(expectation), Encoding.UTF8, "application/json")
6161
};
6262

6363
MockHandler.Protected().Setup<Task<HttpResponseMessage>>("SendAsync",

tests/CommandQuery.Tests/Internal/ExceptionExtensionsTests.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using CommandQuery.Exceptions;
22
using FluentAssertions;
3-
using Newtonsoft.Json;
4-
using Newtonsoft.Json.Converters;
53

64
namespace CommandQuery.Tests.Internal
75
{
@@ -30,8 +28,6 @@ public void when_converting_Exception_to_Error()
3028

3129
result.Message.Should().Be(exception.Message);
3230
result.Details.Should().BeNull();
33-
34-
Console.WriteLine(JsonConvert.SerializeObject(result));
3531
}
3632

3733
[Test]
@@ -65,8 +61,6 @@ public void when_converting_CommandException_to_Error()
6561
result.Details.Should().Contain("List", exception.List);
6662
result.Details.Should().Contain("Enum", exception.Enum);
6763

68-
Console.WriteLine(JsonConvert.SerializeObject(result));
69-
7064
new CommandException("").ToError().Details.Should().BeNull();
7165

7266
((Exception)exception).ToError().Details.Should().NotBeNull();
@@ -103,8 +97,6 @@ public void when_converting_QueryException_to_Error()
10397
result.Details.Should().Contain("List", exception.List);
10498
result.Details.Should().Contain("Enum", exception.Enum);
10599

106-
Console.WriteLine(JsonConvert.SerializeObject(result));
107-
108100
new QueryException("").ToError().Details.Should().BeNull();
109101

110102
((Exception)exception).ToError().Details.Should().NotBeNull();
@@ -147,7 +139,6 @@ public FakeQueryException(string message) : base(message)
147139
}
148140
}
149141

150-
[JsonConverter(typeof(StringEnumConverter))]
151142
public enum FakeEnum
152143
{
153144
None,

0 commit comments

Comments
 (0)