title: Reading appsetting-test.json file in asp.net core 5 test project
body: <p>I have a test project with Asp.net core 5 and trying to read the appsetting values.</p>
  <p>Created an appsetting.test.json file in the test project with below configuration</p>
  <pre><code>{
      &quot;baseUrl&quot;: &quot;https://xxxxx.io/&quot;,
      &quot;user&quot;: {
          &quot;username&quot;: &quot;xxxx.xxxx@gmail.com&quot;,
          &quot;password&quot;: &quot;xxxxxxx@1xx7&quot;
      }
  }
  </code></pre>
  <p>Created a helper class to read the json file</p>
  <pre><code>  public interface IAppSettingConfiguration
      {
          public static IConfiguration InitConfiguration()
          {
              var config = new ConfigurationBuilder()
                  .AddJsonFile(&quot;appsettings.test.json&quot;)
                  .Build();
              return config;
          }
      }
  </code></pre>
  <p>To read the baseurl I am using the below code</p>
  <pre><code>private IConfiguration _iAppSettingConfiguration;
  private static string _readonlypageUrl;
  public GivenAccount(PlaywrightFixture playwrightFixture)
          {
              _iAppSettingConfiguration = IAppSettingConfiguration.InitConfiguration();
              _readonlypageUrl = _iAppSettingConfiguration[&quot;baseUrl&quot;];
              
          }
  </code></pre>
  <p>This is working fine I am able to get the value for base URL. How can use <code>IOption&lt;&gt;</code> to read whole object. In my case I want to read <code>user</code></p>
  <p><a href="https://i.stack.imgur.com/s1EYq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s1EYq.png" alt="enter image description here" /></a></p>
  <p>Not able to find the bind method from <code>Microsoft.Extensions.Configuration</code> namespace</p>
  <pre><code>namespace Microsoft.Extensions.Configuration
  {
    /// &lt;summary&gt;Represents a set of key/value application configuration properties.&lt;/summary&gt;
    public interface IConfiguration
    {
      /// &lt;summary&gt;Gets or sets a configuration value.&lt;/summary&gt;
      /// &lt;param name=&quot;key&quot;&gt;The configuration key.&lt;/param&gt;
      /// &lt;returns&gt;The configuration value.&lt;/returns&gt;
      string this[string key] { get; set; }
  
      /// &lt;summary&gt;Gets a configuration sub-section with the specified key.&lt;/summary&gt;
      /// &lt;param name=&quot;key&quot;&gt;The key of the configuration section.&lt;/param&gt;
      /// &lt;returns&gt;The &lt;see cref=&quot;T:Microsoft.Extensions.Configuration.IConfigurationSection&quot; /&gt;.&lt;/returns&gt;
      IConfigurationSection GetSection(string key);
  
      /// &lt;summary&gt;Gets the immediate descendant configuration sub-sections.&lt;/summary&gt;
      /// &lt;returns&gt;The configuration sub-sections.&lt;/returns&gt;
      IEnumerable&lt;IConfigurationSection&gt; GetChildren();
  
      /// &lt;summary&gt;Returns a &lt;see cref=&quot;T:Microsoft.Extensions.Primitives.IChangeToken&quot; /&gt; that can be used to observe when this configuration is reloaded.&lt;/summary&gt;
      /// &lt;returns&gt;A &lt;see cref=&quot;T:Microsoft.Extensions.Primitives.IChangeToken&quot; /&gt;.&lt;/returns&gt;
      IChangeToken GetReloadToken();
    }
  }
  </code></pre>