Ejemplo n.º 1
0
 public void StrSegWorks()
 {
     Assert.AreEqual("123", MHString.StrSeg("123,456,789", 1, ','), "t1");
     Assert.AreEqual("456", MHString.StrSeg("123,456,789", 2, ','), "t2");
     Assert.AreEqual("789", MHString.StrSeg("123,456,789", 3, ','), "t3");
     Assert.AreEqual(string.Empty, MHString.StrSeg("123,456,789", 4, ','), "t4");
     Assert.AreEqual(string.Empty, MHString.StrSeg("123,456,789", 0, ','), "t5");
     Assert.AreEqual(string.Empty, MHString.StrSeg("123,456,789", -1, ','), "t6");
     Assert.AreEqual(string.Empty, MHString.StrSeg(",456,789", 1, ','), "t7");
     Assert.AreEqual(string.Empty, MHString.StrSeg("", 2, ','), "t8");
     Assert.AreEqual("456", MHString.StrSeg(",456,", 2, ','), "t9");
     Assert.AreEqual("456", MHString.StrSeg(",456", 2, ','), "t10");
     Assert.AreEqual("3456", MHString.StrSeg(",,3456", 3, ','), "t11");
     Assert.AreEqual("123", MHString.StrSeg("123", 1, ','), "t12");
     Assert.AreEqual("456", "123,456,789".StrSeg(2, 1, ','), "t13");
 }