public void ParseFail(string text) { var pu1 = PrivateUseSubtags.TryParse(text); Assert.That(pu1.HasValue, Is.False); PrivateUseSubtags pu2; Assert.That(PrivateUseSubtags.TryParse(text, out pu2), Is.False); Assert.Throws <FormatException>(() => PrivateUseSubtags.Parse(text)); }
public void TryParse(string text, string[] subtags) { var pu1 = PrivateUseSubtags.TryParse(text); Assert.That(pu1.Value, Is.EquivalentTo(subtags)); PrivateUseSubtags pu2; Assert.That(PrivateUseSubtags.TryParse(text, out pu2), Is.True); Assert.That(pu2, Is.EquivalentTo(subtags)); Assert.That(pu1, Is.EqualTo(pu2)); }