Esempio n. 1
0
        public void CanStringJoinArrayOfStringsWithCommaSeparator()
        {
            var seq = new[] { "um", "dois", "três" };
            var str = seq.StringJoin(",");

            str.Should().Be("um,dois,três");
        }
Esempio n. 2
0
        public void CanStringJoinArrayOfIntsWithCommaSeparator()
        {
            var seq = new[] { 1, 2, 3 };
            var str = seq.StringJoin(",");

            str.Should().Be("1,2,3");
        }
Esempio n. 3
0
        public void CanStringJoinArrayOfStrings()
        {
            var seq = new[] { "um", "dois", "três" };
            var str = seq.StringJoin();

            str.Should().Be("umdoistrês");
        }
        public void ValidateStringJoinForEtcString()
        {
            string expectedSequence = utilityObj.xmlUtil.GetTextValue(
                Constants.IEnumerableExtensionsNode, Constants.ExpectedSequence);
            string etcString = utilityObj.xmlUtil.GetTextValue(
                Constants.IEnumerableExtensionsNode, Constants.EtcStringNode);
            int maxLength = Convert.ToInt32(utilityObj.xmlUtil.GetTextValue(
                Constants.IEnumerableExtensionsNode, Constants.MaxAttemptString), CultureInfo.InvariantCulture);
            sequences = utilityObj.xmlUtil.GetTextValue(Constants.IEnumerableExtensionsNode, Constants.Sequence2).Split(';');

            IEnumerable<string> enumerable = new[] { sequences[0], sequences[1], sequences[2], null };
            string join = enumerable.StringJoin(":", maxLength, etcString);
            Assert.IsNotNull(join);
            Assert.AreEqual(expectedSequence, join);

            ApplicationLog.WriteLine("IEnumerableExtensions BVT: Validation of StringJoin method for sequences, separator, length and etc-string completed successfully.");
        }