title: How to unit test a binary format reader class
body: <p>I am working on a class which reads a binary file and stores the value present in that binary file.</p>
  
  <blockquote>
    <p>The question is how to unit test this class, What I have done right
    now is, I deployed a sample file and wrote a unit test for that
    particular file only.</p>
  </blockquote>
  
  <p>Example:- I know that first value in binary file will be a integer and its value will be 60. So I write unit test for that. I have written tests for the whole file. Are those unit-tests enough? Or should I write some more.</p>
  
  <p>Sample Unit-test. I have written tests for all values.</p>
  
  <pre><code>[TestMethod]
  public void First_Integer_Read_Value_Is_60
  {
      // Arrange
      var expected = 60;
      var reader = new MyCustomBinaryReader(filepath);
  
      // Act
      var actual = reader.FirstValue;
  
      //
      Assert.AreEqual(expected, actual)
  }
  
  reader.FirstValue
  {
      get { return BinaryReader.ReadInt32(); }
  }
  </code></pre>
  
  <p>So I am getting 100% code coverage. But is that testing enough? How do we unit-test these kind of classes.</p>