public void TryParse_ErrorTest(string toParse) { bool b = BIP0014.TryParse(toParse, out BIP0014[] actualBips); Assert.False(b); Assert.Null(actualBips); }
public void TryParseTest(string name, Version ver, string cmt, string serializedString) { bool b = BIP0014.TryParse(serializedString, out BIP0014[] bips); Assert.True(b); Assert.Single(bips); Assert.Equal(name, bips[0].ClientName); Assert.Equal(ver ?? new Version(0, 0), bips[0].ClientVersion); // TryParse returns null comment string expCmt = (cmt == "") ? null : cmt; Assert.Equal(expCmt, bips[0].Comment); }
public void TryParse_MultiTest() { bool b = BIP0014.TryParse("/BitcoinJ:0.2(iPad; U; CPU OS 3_2_1)/AndroidBuild:0.8.6/", out BIP0014[] bips); Assert.True(b); Assert.Equal(2, bips.Length); Assert.Equal("BitcoinJ", bips[0].ClientName); Assert.Equal("AndroidBuild", bips[1].ClientName); Assert.Equal(new Version(0, 2), bips[0].ClientVersion); Assert.Equal(new Version(0, 8, 6), bips[1].ClientVersion); Assert.Equal("iPad; U; CPU OS 3_2_1", bips[0].Comment); Assert.Null(bips[1].Comment); }