public void ConcatWithTest_2() { var array = new[] { 100, 1200, 322, 6421, 10, 4052, 666, 111, 4000, 80 }; var actual = array.ConcatWith("; ", "0,0G"); var expected = "100G; 1,200G; 322G; 6,421G; 10G; 4,052G; 666G; 111G; 4,000G; 80G"; Assert.AreEqual(expected, actual); }
public void ConcatWithTest_1() { var array = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var actual = array.ConcatWith(", "); var expected = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"; Assert.AreEqual(expected, actual); }
public void ConcatWithTest() { var s = new[] {"a", "b", "c", "d", "e"}; const string expected = "ambmcmdme"; Assert.AreEqual(expected, s.ConcatWith("m")); }
public void ConcatWithTest_3() { var samples = new sampleClass01[]{ new sampleClass01(){Name="taro",Id=1234,Power=45.23f}, new sampleClass01(){Name="jiro",Id=2222,Power=99.99f}, new sampleClass01(){Name="saburo",Id=9999,Power=10.11f} }; var actual = samples.ConcatWith("//"); var expected = "taro: 1234; 45.23P//jiro: 2222; 99.99P//saburo: 9999; 10.11P"; Assert.AreEqual(expected, actual); actual = samples.ConcatWith(", ", "N", new sampleClass01.Formatter()); expected = "Name: taro, Name: jiro, Name: saburo"; Assert.AreEqual(expected, actual); Console.WriteLine(new[] { 1000, 1980, 3980, 4500, 6398 }.ConcatWith(", ", "C")); var sqrts = Enumerable.Range(1, 10).Select(n => Math.Sqrt(n)); Console.WriteLine(sqrts.ConcatWith(", ", "E03")); var days = new[]{ new DateTime(2013,1,1), new DateTime(2013,2,2), new DateTime(2013,3,3) }; var culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); Console.WriteLine(days.ConcatWith(" / ", "D", culture)); }
public void ConcatWithNewLineTest() { var s = new[] {"a", "b", "c", "d", "e"}; Assert.AreEqual(s.ConcatWith(Environment.NewLine), s.ConcatWithNewLine()); }