Ejemplo n.º 1
0
        /// <summary>
        /// Invoked when the inputs should be processed.
        /// </summary>
        private void SelectColumn()
        {
            // TODO: If we were using .NET 4.5 this should be async aware.
            // TODO: Business Logic is starting to creep in here, abstract!
            if (!string.IsNullOrWhiteSpace(textBoxInput.Text))
            {
                IEnumerable <string> result;

                if (this.sortOutputToolStripMenuItem.Checked)
                {
                    result = ColumnUtility.GetColumnFromStringSorted(textBoxInput.Text, this.options.ColumnDelimiter, this.options.ColumnToSelect);
                }
                else
                {
                    result = ColumnUtility.GetColumnFromString(textBoxInput.Text, this.options.ColumnDelimiter, this.options.ColumnToSelect);
                }

                if (this.filterOutputDistinctToolStripMenuItem.Checked)
                {
                    result = result.Distinct();
                }

                StringBuilder sb = new StringBuilder();
                foreach (string line in result)
                {
                    sb.AppendLine(line);
                }

                this.textBoxOutput.Text = sb.ToString();
            }
        }
Ejemplo n.º 2
0
 public void GetColumnFromStringsSorted_NullArgument_ArgumentException()
 {
     Assert.Throws <ArgumentException>(() => ColumnUtility.GetColumnFromStringsSorted(null, DEFAULT_COLUMN_DELIMITER, DEFAULT_COLUMN_INDEX).ToArray());
 }
Ejemplo n.º 3
0
        public void GetColumnFromStringsSorted_EmptySet_ArgumentException()
        {
            IEnumerable <string> testSet = new string[1];

            Assert.Throws <ArgumentException>(() => ColumnUtility.GetColumnFromStringsSorted(testSet, DEFAULT_COLUMN_DELIMITER, DEFAULT_COLUMN_INDEX).ToArray());
        }
Ejemplo n.º 4
0
        public void GetColumnFromStringSorted_EmptyString_ArgumentException()
        {
            string testString = string.Empty;

            Assert.Throws <ArgumentException>(() => ColumnUtility.GetColumnFromStringSorted(testString, DEFAULT_COLUMN_DELIMITER, DEFAULT_COLUMN_INDEX));
        }