Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,59 @@
}

[Fact]
public void TestRead()
public void TestReadNotString()
{
// Arrange
// Use a canonical all-zero UUID representation which is commonly accepted by UUID parsers.
const string input = "00000000-0000-0000-0000-000000000000";

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

The variable 'input' is assigned but its value is never used

Check warning on line 47 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

The variable 'input' is assigned but its value is never used
string jsonText = "0";
byte[] json = Encoding.UTF8.GetBytes(jsonText);
var reader = new Utf8JsonReader(json);
reader.Read();

// Act
JsonException ex = null;

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

Converting null literal or possible null value to non-nullable type.

Check warning on line 54 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

Converting null literal or possible null value to non-nullable type.
try
{
_converter.Read(ref reader, typeof(Uuid), new JsonSerializerOptions());
}
catch (JsonException caught)
{
ex = caught;
}

// Assert
Assert.NotNull(ex);
}

[Fact]
public void TestReadEmptyString()
{
// Arrange
// Use a canonical all-zero UUID representation which is commonly accepted by UUID parsers.
const string input = "00000000-0000-0000-0000-000000000000";

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

The variable 'input' is assigned but its value is never used

Check warning on line 73 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

The variable 'input' is assigned but its value is never used
string jsonText = "\"\"";
byte[] json = Encoding.UTF8.GetBytes(jsonText);
var reader = new Utf8JsonReader(json);
reader.Read();

// Act
JsonException ex = null;

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on ubuntu-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x on windows-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in TensionDev.UUID.Serialization.SystemTextJson.Tests/TestUuidSystemTextJsonConverter.cs

View workflow job for this annotation

GitHub Actions / .NET 8.0.x

Converting null literal or possible null value to non-nullable type.
try
{
_converter.Read(ref reader, typeof(Uuid), new JsonSerializerOptions());
}
catch (JsonException caught)
{
ex = caught;
}

// Assert
Assert.NotNull(ex);
}

[Fact]
public void TestReadString()
{
// Arrange
// Use a canonical all-zero UUID representation which is commonly accepted by UUID parsers.
Expand Down