title: Unit Testing Internal List<String>
body: <pre><code>using System;
  using System.Collections.Generic;
  using System.Text;
  
  [Serializable]
  public class ColumnDataField
  {
      #region Fields
  
      private int _columnIndex;
      private string _dataFields;
  
      #endregion Fields
  
      #region Properties
  
      /// &lt;summary&gt;
      /// Column index
      /// &lt;/summary&gt;
      public int ColumnIndex
      {
          get { return _columnIndex; }
          set { _columnIndex = value; }
      }
  
      /// &lt;summary&gt;
      /// Data fields
      /// &lt;/summary&gt;
      public string DataFields
      {
          get { return _dataFields; }
          set { _dataFields = value; }
      }
  
      /// &lt;summary&gt;
      /// Convert DataFields string to data field list
      /// &lt;/summary&gt;
      internal List&lt;String&gt; DataFieldList
      {
          get
          {
              if (string.IsNullOrWhiteSpace(DataFields)) return new List&lt;String&gt;();
  
              string[] _array = DataFields.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  
              List&lt;String&gt; _fields = new List&lt;String&gt;(_array);
  
              for (int _i = _fields.Count - 1; _i &gt;= 0; _i--)
              {
                  _fields[_i] = _fields[_i].Trim();
                  if (string.IsNullOrWhiteSpace(_fields[_i])) _fields.RemoveAt(_i);
              }
  
              return _fields;
          }
  
          set
          {
              StringBuilder _buffer = new StringBuilder();
  
              foreach (string _field in value)
              {
                  if (_buffer.Length &gt; 0) _buffer.Append(",");
                  _buffer.Append(_field);
              }
  
              DataFields = _buffer.ToString();
          }
      }
  
      #endregion Properties
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I'm an intern unit testing in C# so go easy on me.</p>
  
  <p>I haven't had too many problems with my other projects but I can't seem to figure out how I'm suppose to unit test the internal List.</p>
  
  <p>This is the code that I have so far for my unit test:</p>
  
  <pre><code>    [TestMethod]
      public void DataFields_Test()
      {
          ColumnDataField questionText = new ColumnDataField();
          questionText.DataFields = "test";
          string expected = "test";
          string actual = questionText.DataFields;
          Assert.AreEqual(expected, actual);
      }      
  </code></pre>
  
  <p>So that will run the DataFields property but other than that it's not going over any of the other code. I've been searching online for days trying to figure out the best way to go about this. I don't need to be told exactly what to do but guidance would be greatly appreciated.</p>