title: How to assert enum in C# using NUnit
body: <p>I'm using NUnit on a .NET C# project</p>
  
  <p>I need to assert that historyRecord.InstrType is equal to InstrType.Nanodac</p>
  
  <p>I've got a variable <code>myVal</code> of type <code>InstrType</code></p>
  
  <p>where InstrType is an enum:</p>
  
  <pre><code>public enum InstrType
  {
  HydraSbs,
  HydraLbs,
  HydraSfs,
  HydraLfs,
  HydraEconomique,
  Blind,
  Lxio,
  Sxio,
  Sfse,
  T800QVga,
  T800SVGa,
  Eycon10,
  Eycon20,
  T2550,
  T2750,
  Nanodac
  }
  </code></pre>
  
  <p>I need to assert this:</p>
  
  <pre><code>Assert.AreEqual(myVal, InstrType.Nanodac)
  </code></pre>
  
  <p>but it raises an exception ("expected Nanodac but was HydraSbs").
  So I tried this: </p>
  
  <pre><code>Assert.That(myVal, Is.EqualTo(InstrType.Nanodac))
  </code></pre>
  
  <p>again, it raises the same exception!</p>
  
  <p>I tested with the debugger and <code>myVal</code> is valorized correctly as InstrType.Nanodac</p>
  
  <p>I smell an enum bad cast as it picks the first value of the list (hydraSbs)</p>