title: How to unit test an empty enum?
body: <p>I have an extension method that calculates due date based on date period type. The method looks like this:</p>
  
  <pre><code>public static DateTime CalculateDueDate(this DateTime date, OffsetType offsetType, int offset)
  {
      switch (offsetType)
      {
          case OffsetType.Days:
              return date.AddDays(offset);
          case OffsetType.Weeks:
              return date.AddWeeks(offset);
          case OffsetType.Months:
              return date.AddMonths(offset);
          default:
              throw new ArgumentOutOfRangeException("offsetType", offsetType, null);
      }
  }
  </code></pre>
  
  <p>where OffsetType enum has these possible values:</p>
  
  <pre><code>public enum OffsetType
  {
      Months = 1,
      Weeks = 2,
      Days = 3
  }
  </code></pre>
  
  <p>How can I make sure that <strong><code>ArgumentOutOfRangeException</code></strong> is thrown when <code>OffsetType</code> <code>enum</code> is not provided (or provided with invalid value)? Do I even need to worry about unit testing that exception if <code>OffsetType</code> parameter is not <code>null</code>?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I wish I could vote for multiple answers. I decided to use out-of-range value suggested by <a href="https://stackoverflow.com/a/37972480/4383585">Lee</a> and <a href="https://stackoverflow.com/a/37972451/4383585">dasblinkenlight</a>. Here is my fins unit test:</p>
  
  <pre><code>    [Test]
      public void CalculateDueDate_Throw_Exception_Test()
      {
          var date = DateTime.Now;
          var period = 3;
          var offsetType = (OffsetType) (-1);
  
          Assert.Throws&lt;ArgumentOutOfRangeException&gt;(() =&gt; date.CalculateDueDate(offsetType, period));
      }
  </code></pre>