public void TryParse_With_Valid_Input(string input, char?separator, byte[] expected) { var actual = new byte[expected.Length]; var succeeded = Hexadecimal.TryParse(input, actual, separator); Assert.True(succeeded); Assert.Equal(expected, actual); }
public void Write_Succeeds(string stationId6, string muxs, string routerDataEndpoint, string expected) { var stationEui = stationId6.Contains(':', StringComparison.Ordinal) ? Id6.TryParse(stationId6, out var id6) ? new StationEui(id6) : throw new JsonException() : Hexadecimal.TryParse(stationId6, out ulong hhd, '-') ? new StationEui(hhd) : throw new JsonException(); var computed = Json.Stringify(w => LnsDiscovery.WriteResponse(w, stationEui, muxs, new Uri(routerDataEndpoint))); Assert.Equal(expected, computed); }