title: Unit testing DateTime strings
body: <p>I have a class that converts a <code>string</code> into a <code>DateTime</code> and perform some business logic in it:</p>
  
  <pre><code>public class Foo
  {
      public Foo(string value)
      {
          Value = DateTime.Parse(value);
      }
  
      public DateTime Value { get; }
  
      // Some additional methods
  }
  </code></pre>
  
  <p>I would like to unit test <code>Foo</code> so that it only accepts valid datetime <code>string</code>s, so I wrote a unit test:</p>
  
  <pre><code>public class FooTests
  {
      [Fact]
      public void Foo_ValidDateTimeString_Returns()
      {
          const string testInput = "2015-01-01";
  
          var result = new Foo(testInput);
  
          var expected = new DateTime(2015, 1, 1);
          Assert.Equal(expected, result.Value);
      }
  }
  </code></pre>
  
  <p>This test passes in various cultures such as en-US.</p>
  
  <p>My concern is, this unit test will fail when another colleague who is under a different <code>CultureInfo</code> which does not accept <code>yyyy-MM-dd</code> as a valid <code>DateTime</code> format.</p>
  
  <p>I do not want to enforce the test to be run under a specific <code>CultureInfo</code> in order to make the test pass. Is there another way?</p>