title: How to implement date restrictions with AutoFixture?
body: <p>I'm currently having a model class which contains several properties. A simplified model could look like this:</p>
  
  <pre><code>public class SomeClass
  {
      public DateTime ValidFrom { get; set; }
      public DateTime ExpirationDate { get; set; }
  }
  </code></pre>
  
  <p>Now I'm implementing some unit tests by using NUnit and use AutoFixture to create some random data:</p>
  
  <pre><code>[Test]
  public void SomeTest()
  { 
      var fixture = new Fixture();
      var someRandom = fixture.Create&lt;SomeClass&gt;();
  }
  </code></pre>
  
  <p>This works perfect so far. But there is the requirement that the date of <code>ValidFrom</code> <strong>is always before</strong> <code>ExpirationDate</code>. I have to ensure this since I'm implementing some positive tests.</p>
  
  <p>So is there an <em>easy</em> way to implement this by using AutoFixture? I know I could create a fix date and add a random date interval to solve this, but it would be great if AutoFixture could handle this requirement itself.</p>
  
  <p>I haven't got a lot of experience with AutoFixture, but I know I can get an <code>ICustomizationComposer</code> by calling the <code>Build</code> method:</p>
  
  <pre><code>var fixture = new Fixture();
  var someRandom = fixture.Build&lt;SomeClass&gt;()
      .With(some =&gt; /*some magic like some.ValidFrom &lt; some.ExpirationDate here...*/ )
      .Create();
  </code></pre>
  
  <p>Maybe this is the right way to achieve this?</p>
  
  <p>Thanks in advance for any help.</p>