Skip to content

Commit

Permalink
Fixes on 2022-07-13 (#93)
Browse files Browse the repository at this point in the history
Remove example tags and use `System.Text.Json` instead of `Newtonsoft.Json` in the unit tests.
  • Loading branch information
mburumaxwell authored Jul 13, 2022
1 parent d8c05e2 commit ea3391f
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 26 deletions.
1 change: 0 additions & 1 deletion src/FaluSdk/Core/IHasCurrency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ public interface IHasCurrency
/// Three-letter <see href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</see>,
/// in lowercase.
/// </summary>
/// <example>kes</example>
string? Currency { get; set; }
}
1 change: 0 additions & 1 deletion src/FaluSdk/Files/File.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class File : IHasId, IHasCreated, IHasUpdated, IHasDescription, IHasWorks
public string? Purpose { get; set; }

/// <summary>Type of file.</summary>
/// <example>image/png</example>
public string? Type { get; set; }

/// <summary>A name of the file suitable for saving to a filesystem.</summary>
Expand Down
1 change: 0 additions & 1 deletion src/FaluSdk/Identity/IdentitySearchModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class IdentitySearchModel : IHasCountry
/// The phone number to search in <see href="https://en.wikipedia.org/wiki/E.164">E.164 format</see>.
/// Required if <see cref="DocumentNumber"/> is not specified.
/// </summary>
/// <example>+254722000000</example>
public string? Phone { get; set; }

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/FaluSdk/Messages/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class Message : MessagePatchModel, IHasId, IHasCreated, IHasUpdated, IHas
/// <summary>
/// Destination phone number in <see href="https://en.wikipedia.org/wiki/E.164">E.164 format</see>.
/// </summary>
/// <example>+254722000000</example>
public string? To { get; set; }

/// <summary>
Expand Down
10 changes: 5 additions & 5 deletions tests/FaluSdk.Tests/Clients/BaseServiceClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Falu.Core;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using Xunit;

namespace Falu.Tests.Clients;
Expand Down Expand Up @@ -32,7 +32,7 @@ protected DynamicHttpMessageHandler GetAsync_Handler(RequestOptions? options = n
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(Data), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(Data), Encoding.UTF8, MediaTypeNames.Application.Json)
};
});

Expand All @@ -52,7 +52,7 @@ protected DynamicHttpMessageHandler ListAsync_Handler(bool? hasContinuationToken
var content = new List<TResource> { Data };
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(content), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(content), Encoding.UTF8, MediaTypeNames.Application.Json)
};
if (hasContinuationToken.GetValueOrDefault())
Expand All @@ -78,7 +78,7 @@ protected DynamicHttpMessageHandler CreateAsync_Handler(RequestOptions? options
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(Data), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(Data), Encoding.UTF8, MediaTypeNames.Application.Json)
};
return response;
Expand All @@ -98,7 +98,7 @@ protected DynamicHttpMessageHandler UpdateAsync_Handler(RequestOptions? options
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(Data), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(Data), Encoding.UTF8, MediaTypeNames.Application.Json)
};
});

Expand Down
4 changes: 2 additions & 2 deletions tests/FaluSdk.Tests/Clients/EvaluationsServiceClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Falu.Core;
using Falu.Evaluations;
using Newtonsoft.Json;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using Tingle.Extensions.JsonPatch;
using Xunit;

Expand Down Expand Up @@ -136,7 +136,7 @@ public async Task ScoreAsync_Works(RequestOptions options)
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
};
return response;
Expand Down
4 changes: 2 additions & 2 deletions tests/FaluSdk.Tests/Clients/IdentityServiceClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Falu.Core;
using Falu.Identity;
using Newtonsoft.Json;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using Xunit;

namespace Falu.Tests.Clients;
Expand Down Expand Up @@ -36,7 +36,7 @@ public async Task SearchAsync_Works(RequestOptions options)
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(identity), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(identity), Encoding.UTF8, MediaTypeNames.Application.Json)
};
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Falu.Core;
using Falu.MessageStreams;
using Newtonsoft.Json;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using Tingle.Extensions.JsonPatch;
using Xunit;

Expand Down Expand Up @@ -121,7 +121,7 @@ public async Task ArchiveAsync_Works(RequestOptions options)
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
};
});

Expand All @@ -147,7 +147,7 @@ public async Task UnarchiveAsync_Works(RequestOptions options)
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
};
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Falu.Core;
using Falu.MessageTemplates;
using Newtonsoft.Json;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using Tingle.Extensions.JsonPatch;
using Xunit;

Expand Down Expand Up @@ -160,7 +160,7 @@ public async Task ValidateAsync_Works(RequestOptions options)
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(content), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(content), Encoding.UTF8, MediaTypeNames.Application.Json)
};
return response;
Expand Down
4 changes: 2 additions & 2 deletions tests/FaluSdk.Tests/Clients/MessagesServiceClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Falu.Core;
using Falu.Messages;
using Newtonsoft.Json;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using Tingle.Extensions.JsonPatch;
using Xunit;

Expand Down Expand Up @@ -130,7 +130,7 @@ public async Task SendBatchAsync_Works(RequestOptions options)
};
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(content), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(content), Encoding.UTF8, MediaTypeNames.Application.Json)
};
return response;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Falu.Core;
using Falu.Payments;
using Newtonsoft.Json;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using Xunit;

namespace Falu.Tests.Clients;
Expand Down Expand Up @@ -35,7 +35,7 @@ public async Task GetAsync_Works(RequestOptions options)
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(data), Encoding.UTF8, MediaTypeNames.Application.Json)
};
});

Expand All @@ -60,7 +60,7 @@ public async Task RefreshAsync_Works(RequestOptions options)
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(data), Encoding.UTF8, MediaTypeNames.Application.Json)
};
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Falu.Core;
using Falu.PaymentAuthorizations;
using Newtonsoft.Json;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using Tingle.Extensions.JsonPatch;
using Xunit;

Expand Down Expand Up @@ -94,7 +94,7 @@ public async Task ApproveAsync_Works(RequestOptions options)
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
};
return response;
Expand Down Expand Up @@ -123,7 +123,7 @@ public async Task DeclineAsync_Works(RequestOptions options)
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
Content = new StringContent(JsonSerializer.Serialize(Data!), Encoding.UTF8, MediaTypeNames.Application.Json)
};
return response;
Expand Down

0 comments on commit ea3391f

Please sign in to comment.