public void ParseFail(string text) { var pu1 = PrivateUseSubtags.TryParse(text); Assert.That(pu1.HasValue, Is.False); Assert.That(PrivateUseSubtags.TryParse(text, out _), Is.False); Assert.Throws <FormatException>(() => PrivateUseSubtags.Parse(text)); }
public void Equals() { var tag1 = new PrivateUseSubtags(); var tag2 = (object)tag1; var tag3 = PrivateUseSubtags.Parse("x-aaa"); var tag4 = (object)PrivateUseSubtags.Parse("x-aaa"); var tag5 = PrivateUseSubtags.Parse("x-aaa-bbb"); Assert.IsFalse(tag1.Equals(null)); Assert.IsTrue(tag1.Equals(tag2)); Assert.AreEqual(tag1, tag1); Assert.AreNotEqual(tag1, tag3); Assert.AreEqual(tag3, tag3); Assert.AreEqual(tag3, tag4); Assert.AreNotEqual(tag4, tag5); }
public void Contains(string?subtagText, string tag, bool expected) { var pu = subtagText is null ? new PrivateUseSubtags() : PrivateUseSubtags.Parse(subtagText); Assert.That(pu.Contains(tag), Is.EqualTo(expected)); }