title: Modifying a private static readonly field
body: <p>I have a large application that reads some parameters from a configuration file.</p>
  
  <p>I'm writing unit tests for a class that generates a result after performing certain operations with both a parameter and a value read from the configuration file:</p>
  
  <pre><code>internal static class Password
  {
      private static readonly byte PASSWORD_PRIVATE_KEY
          = ConfigFile.ReadByte("PASSWORD_PRIVATE_KEY");
  
      public static byte Generate(byte passwordPublicKey);
  }
  </code></pre>
  
  <p>In my unit test, I know the values the <code>Password.Generate()</code> method should return for given <code>PASSWORD_PRIVATE_KEY</code>and <code>PASSWORD_PUBLIC_KEY</code>. But I'd like the <code>PASSWORD_PRIVATE_KEY</code> value used to be defined in the unit test class, not in the configuration file:</p>
  
  <pre><code>[TestMethod]
  public void PasswordGenerate_CalculatedProperly()
  {
      byte passwordPublicKey = 0x22;
      Password_Accessor.PASSWORD_PRIVATE_KEY = 0xF0;
      byte expectedGenerated = 0xAA;
  
      byte generated = Password_Accessor.Generate(passwordPublicKey);
  
      Assert.AreEqual(expectedGenerated, generated);
  }
  </code></pre>
  
  <p>Is there a way I can write the <code>private static readonly</code> thru code, so I don't have to rely any configuration file for my tests?</p>