title: How to use AutoFixture to generate specific values when the Builder is given an abstract class
body: <p>I'm trying to generate specific values for a class with AutoFixture but the <code>Builder</code> is given an <code>abstract</code> class. As such, the builder can't see the properties for either concrete types ... and therefore cannot/doesn't know when/how to create them.</p>
  <p>e.g.</p>
  <pre><code>public abstract class BaseClass
  {
      // Common properties.
      public string Id { get; set }
      public Baa Baa { get; set; }
  }
  
  public class ConcreteA : BaseClass
  {
      public string Name { get; set ;}
  }
  
  public class ConcreteB : BaseClass
  {
      public NumberOfPeople int { get; set }
  }
  </code></pre>
  <p>So, when I create a fake instance of a BaseClass, I'm hoping to set the concrete value, where appropriate.</p>
  <p>e.g.</p>
  <pre><code>Class      | Property and value, to set.
  ----------------------------------------
  ConcreteA  | Name = &quot;Jane&quot;
  ConcreteB  | NumberOfPeople = 3
  </code></pre>
  <p>I'm not sure how to define (in the <code>Builder</code>) that when <code>currentType == typeof(ConcreteA) then do this...</code> etc.</p>
  <h3>Update</h3>
  <p>This is how I am currently creating my fake instances:</p>
  <pre><code>public static T CreateAThing&lt;T&gt;() where T : BaseClass, new()
  {
      var fixture = new Fixture();
      return fixture.Build&lt;T&gt;()
          .With(x =&gt; x.Id, $&quot;things-{fixture.Create&lt;int&gt;()}&quot;)
          .Create();
  }
  </code></pre>
  <p>where the <code>Id</code> is a consecutive number appended to some fixed string.</p>
  <p>Now, when <code>T</code> is a <code>ConcreteA</code>, then I was hoping to have it do some specific logic. (like set the name to be some first name + surname) while if <code>T</code> is a <code>ConcreteB</code>, then some random number from 1 to 10.</p>
  <p>NOTE: The reason I was doing it like this, was because I was just thinking about not repeating myself for the baseclass properties (like how I'm wanting the <code>Id</code> property to be <code>things-&lt;consecutive number&gt;</code>.</p>
  <p>Open to <em>all</em> ideas :)</p>