-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from ashakoor/main
v0.7.0-beta
- Loading branch information
Showing
315 changed files
with
12,950 additions
and
9,094 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
30 changes: 30 additions & 0 deletions
30
BungieSharper.CodeGen.Entities.Tests/BungieSharper.CodeGen.Entities.Tests.csproj
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,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Authors>ashakoor</Authors> | ||
<Copyright>Copyright © 2020-2021 ashakoor</Copyright> | ||
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression> | ||
<RepositoryUrl>https://github.com/ashakoor/BungieSharper</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
|
||
<TargetFramework>net5.0</TargetFramework> | ||
<Version>0.7.0-beta</Version> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="1.3.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<ProjectReference Include="..\BungieSharper.CodeGen.Entities\BungieSharper.CodeGen.Entities.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,43 @@ | ||
using System.IO; | ||
using System.Text.Json; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace BungieSharper.CodeGen.Entities.Tests | ||
{ | ||
public class EntityTest : IClassFixture<SpecFixture> | ||
{ | ||
private readonly string SpecStringContent; | ||
|
||
public EntityTest(SpecFixture specStringFixture) | ||
{ | ||
SpecStringContent = specStringFixture.SpecFileContent; | ||
} | ||
|
||
[Fact] | ||
public async Task DeserializeAndSerializeTest() | ||
{ | ||
var _serializerOptions = new JsonSerializerOptions | ||
{ | ||
WriteIndented = true | ||
}; | ||
|
||
_serializerOptions.Converters.Add(new JsonLongConverter()); | ||
_serializerOptions.Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping; | ||
|
||
var openApiObj = JsonSerializer.Deserialize<OpenApiObject>(SpecStringContent, _serializerOptions); | ||
|
||
var serialized = JsonSerializer.Serialize(openApiObj, _serializerOptions); | ||
|
||
var removeWhitespace = new Regex(@"\s+"); | ||
|
||
await File.WriteAllTextAsync("testOutput.json", serialized); | ||
|
||
var noWhitespaceInput = removeWhitespace.Replace(SpecStringContent, "").ToLowerInvariant(); | ||
var noWhitespaceSerialized = removeWhitespace.Replace(serialized, "").ToLowerInvariant(); | ||
|
||
Assert.Equal(noWhitespaceInput.Length, noWhitespaceSerialized.Length); | ||
} | ||
} | ||
} |
Oops, something went wrong.