title: Unit testing body of properties
body: <p>This is my Code</p>
  
  <pre><code>public class AssistanceRequest : DocumentBase
  {
      public AssistanceRequest()
      {
          RequestTime = DateTime.Now;
          ExcecutionTime = DateTime.MaxValue;
      }
  
      public AssistanceRequest(int amount, string description, DateTime? requestTime) : this()
      {
          //Check for basic validations
          if (amount &lt;= 0)
              throw new Exception("Amount is not Valid");
          this.Amount = amount;
          this.Description = description;
          this.RequestTime = requestTime ?? DateTime.Now;
      }
  
      private long Amount { get; set; }
  
      private DateTime requestTime { get; set; }
  
      public DateTime RequestTime
      {
          get { return requestTime; }
          set
          {
              if (value != null &amp;&amp; value &lt; DateTime.Now)
                  throw new Exception("Request Time is not Allowed");
              requestTime = value;
          }
      }
  </code></pre>
  
  <p>As you can see I have a validation in my Set body. I need to test it.
  and I try to call the constructor in my Tests. but I get Exception in Constructor ( act ) before assertion. How to make my tests right?</p>
  
  <p>This is my Test:</p>
  
  <pre><code>[Theory]
      [MemberData("RequestFakeData")]
      public void Should_Throw_Exception_RequestDate(int amount, string description, DateTime requestDate)
      {
          var manager = new AssistanceRequest(amount,description,requestDate);
          manager.Invoking(x =&gt; x.SomeMethodToChangeRequestTime).ShouldThrowExactly&lt;Exception&gt;()
      }
  
      public static IEnumerable&lt;object[]&gt; RequestFakeData
      {
          get
          {
              // Or this could read from a file. :)
              return new[]
              {
              new object[] { 0,string.Empty,DateTime.Now.AddDays(1) },
              new object[] { 2,"",DateTime.Now.AddDays(-2) },
              new object[] { -1,string.Empty,DateTime.Now.AddDays(-3) },
              };
          }
      }
  </code></pre>
  
  <p>I get the Error in about this Line:</p>
  
  <pre><code>var manager = new AssistanceRequest(amount,description,requestDate);
  </code></pre>
  
  <p>the constructor is trying to set the property so it gets the Exception. and does not get to the assertion.</p>
  
  <p>My question is: How can I test this without changing my constructor?</p>