mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-02-04 05:36:12 +00:00
112 lines
2.9 KiB
C#
112 lines
2.9 KiB
C#
using SabreTools.Data.ObjectIdentifier;
|
|
using Xunit;
|
|
|
|
namespace SabreTools.Serialization.Test.ObjectIdentifier
|
|
{
|
|
// These tests are known to be incomplete due to the sheer number
|
|
// of possible OIDs that exist. The tests below are a minimal
|
|
// representation of functionality to guarantee proper behavior
|
|
// not necessarily absolute outputs
|
|
public class ParserTests
|
|
{
|
|
#region ASN.1
|
|
|
|
[Fact]
|
|
public void ASN1Notation_AlwaysNull()
|
|
{
|
|
ulong[]? values = null;
|
|
string? actual = Parser.ParseOIDToASN1Notation(values);
|
|
Assert.Null(actual);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Dot Notation
|
|
|
|
[Fact]
|
|
public void DotNotation_NullValues_Null()
|
|
{
|
|
ulong[]? values = null;
|
|
string? actual = Parser.ParseOIDToDotNotation(values);
|
|
Assert.Null(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void DotNotation_EmptyValues_Null()
|
|
{
|
|
ulong[]? values = [];
|
|
string? actual = Parser.ParseOIDToDotNotation(values);
|
|
Assert.Null(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void DotNotation_Values_Formatted()
|
|
{
|
|
string expected = "0.1.2.3";
|
|
ulong[]? values = [0, 1, 2, 3];
|
|
string? actual = Parser.ParseOIDToDotNotation(values);
|
|
Assert.Equal(expected, actual);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Modified OID-IRI
|
|
|
|
[Fact]
|
|
public void ModifiedOIDIRI_NullValues_Null()
|
|
{
|
|
ulong[]? values = null;
|
|
string? actual = Parser.ParseOIDToModifiedOIDIRI(values);
|
|
Assert.Null(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void ModifiedOIDIRI_EmptyValues_Null()
|
|
{
|
|
ulong[]? values = [];
|
|
string? actual = Parser.ParseOIDToModifiedOIDIRI(values);
|
|
Assert.Null(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void ModifiedOIDIRI_Values_Formatted()
|
|
{
|
|
string expected = "/ITU-T/[question]/2/3";
|
|
ulong[]? values = [0, 1, 2, 3];
|
|
string? actual = Parser.ParseOIDToModifiedOIDIRI(values);
|
|
Assert.Equal(expected, actual);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region OID-IRI
|
|
|
|
[Fact]
|
|
public void OIDIRI_NullValues_Null()
|
|
{
|
|
ulong[]? values = null;
|
|
string? actual = Parser.ParseOIDToOIDIRINotation(values);
|
|
Assert.Null(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void OIDIRI_EmptyValues_Null()
|
|
{
|
|
ulong[]? values = [];
|
|
string? actual = Parser.ParseOIDToOIDIRINotation(values);
|
|
Assert.Null(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void OIDIRI_Values_Formatted()
|
|
{
|
|
string expected = "/ITU-T/1/2/3";
|
|
ulong[]? values = [0, 1, 2, 3];
|
|
string? actual = Parser.ParseOIDToOIDIRINotation(values);
|
|
Assert.Equal(expected, actual);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|