title: c# unit test datetime against string
body: <p>I am doing a unit test for datetime and it fails because Test Name: </p>
  
  <blockquote>
    <p>GetDateTime2 Result Message:  Assert.AreEqual failed.
    Expected:&lt;28/05/2017 20:00:00 (System.String)>. Actual:&lt;28/05/2017
    20:00:00 (System.DateTime)>.</p>
  </blockquote>
  
  <p>Is there any way of comparing the string against the datetime of do i have to change the properties of string date and string time?</p>
  
  <pre><code>public void GetDateTime()
  {
        FootballEvent football = new FootballEvent();
        football.Time = "20:00:00";
        football.Date = "28/05/2017";
        var footballtime = football.GetDateTime();
        var expected = "28/05/2017 20:00:00";
        Assert.AreEqual(expected, footballtime);  
  }
  </code></pre>