public void ToString_VerFieldCount_Test(Version ver, int count, string exp) { var bip = new BIP0014("Foo", ver); string actual = bip.ToString(count); string expected = $"/Foo:{exp}/"; Assert.Equal(expected, actual); }
public void ConstructorTest(string name, Version ver, string cmt, string expected) { BIP0014 bip = new BIP0014(name, ver, cmt); string actualStr = bip.ToString(); byte[] actualBa = bip.ToByteArray(); Assert.Equal(name, bip.ClientName); Assert.Equal(ver ?? new Version(0, 0), bip.ClientVersion); Assert.Equal(cmt, bip.Comment); Assert.Equal(expected, actualStr); Assert.Equal(Encoding.UTF8.GetBytes(expected), actualBa); }
/// <summary> /// Initializes a new instance of <see cref="ClientSettings"/> with the given parameters. /// </summary> /// <param name="pver">Protocol version</param> /// <param name="relay">True to relay blocks and transactions; false otherwise</param> /// <param name="ua">User agent</param> /// <param name="netType">Network type</param> /// <param name="servs">Services supported by this node</param> public ClientSettings(int pver, bool relay, BIP0014 ua, NetworkType netType, NodeServiceFlags servs) : this(pver, relay, ua.ToString(), netType, servs) { }