public void Concat () { string string1 = "string1"; string string2 = "string2"; string concat = "string1string2"; Assert.IsTrue (String.Concat (string1, string2) == concat); Assert.AreEqual (string1, String.Concat (string1, null)); Assert.AreEqual (string1, String.Concat (null, string1)); Assert.AreEqual (string.Empty, String.Concat (null, null)); WeirdToString wts = new WeirdToString (); Assert.AreEqual (string1, String.Concat (string1, wts)); Assert.AreEqual (string1, String.Concat (wts, string1)); Assert.AreEqual (string.Empty, String.Concat (wts, wts)); string [] allstr = new string []{ string1, null, string2, concat }; object [] allobj = new object []{ string1, null, string2, concat }; string astr = String.Concat (allstr); Assert.AreEqual ("string1string2string1string2", astr); string ostr = String.Concat (allobj); Assert.AreEqual (astr, ostr); }
public void TestConcat () { string string1 = "string1"; string string2 = "string2"; string concat = "string1string2"; Assert (String.Concat (string1, string2) == concat); AssertEquals (string1, String.Concat (string1, null)); AssertEquals (string1, String.Concat (null, string1)); AssertEquals ("", String.Concat (null, null)); WeirdToString wts = new WeirdToString (); AssertEquals (string1, String.Concat (string1, wts)); AssertEquals (string1, String.Concat (wts, string1)); AssertEquals ("", String.Concat (wts, wts)); string [] allstr = new string []{ string1, null, string2, concat }; object [] allobj = new object []{ string1, null, string2, concat }; string astr = String.Concat (allstr); AssertEquals ("string1string2string1string2", astr); string ostr = String.Concat (allobj); AssertEquals (astr, ostr); }