public virtual void TestEncode() { #region check on not correct range try { var pr1 = new PortRange("2a"); Assert.Fail(); } catch (Indeterminate e) { Assert.AreEqual(e.Message, Indeterminate.IndeterminateSyntaxError); } var pr2 = new PortRange("-2"); Assert.AreEqual(pr2.PortStart, 1); try { var pr3 = new PortRange("2-a"); Assert.Fail(); } catch (Indeterminate e) { Assert.AreEqual(e.Message, Indeterminate.IndeterminateSyntaxError); } #endregion string expResult = "13-216"; var instance = new PortRange(expResult); string result = instance.Encode(); Assert.AreEqual(expResult, result); }