<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: is there an equivalent of the mockMvc class for dotnet integration testing in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/is-there-an-equivalent-of-the-mockMvc-class-for-dotnet/m-p/84133#M53044</link>
    <description>&lt;P&gt;The problem is that if I use the code below, it still executing the Program.cs which in my case has custom middleware that I dont want executed in my tests. How do I go about to create a custom Program class, that DONT execute my main Program.cs:&lt;/P&gt;&lt;PRE&gt;public async Task HelloWorldTest()
{
    var application = new WebApplicationFactory&amp;lt;Program&amp;gt;()
        .WithWebHostBuilder(builder =&amp;gt;
        {
            // ... Configure test services
        });

    var _client = application.CreateClient();
    var response = await _client.GetAsync("localhost://home");
}```

Reference: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0&amp;amp;viewFallbackFrom=aspnetcore-2.2&lt;/PRE&gt;&lt;P&gt;Check out the documentation on integration tests and mock up your "custom middleware".&lt;/P&gt;&lt;P&gt;Documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0&lt;/A&gt;&amp;nbsp;&lt;A href="https://e-chats.com/omegle" target="_blank" rel="noopener"&gt;/echat&lt;/A&gt;&lt;A href="https://chatspin.download" target="_blank" rel="noopener"&gt;spin&lt;/A&gt; &lt;A href="https://echat.date" target="_blank" rel="noopener"&gt;/echat&lt;/A&gt;&lt;A href="https://chatrandom.download/omegle/" target="_blank" rel="noopener"&gt;random&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;I hope this helped you some on the way.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Sep 2022 11:57:29 GMT</pubDate>
    <dc:creator>JackToncatrina</dc:creator>
    <dc:date>2022-09-14T11:57:29Z</dc:date>
    <item>
      <title>is there an equivalent of the mockMvc class for dotnet integration testing</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/is-there-an-equivalent-of-the-mockMvc-class-for-dotnet/m-p/83617#M52736</link>
      <description>&lt;P class=""&gt;The guides I’ve seen either mock out the data layer / services and unit test controllers or have a lot of repetitive setup where they effectively reconfigure the app for testing an API as a whole. In both cases I’m concerned about env parity where there can be drift between the configuration defined in the app and tests.&lt;/P&gt;&lt;P class=""&gt;In spring testing they exposed a mockMvc class that would start the server as defined by the app config and then allow you to make requests and assertions against it. You could either supply a connection string to hit a test DB or override it with an in-memory one. This gave a better sense of behavior as everything was “real” short of virtualizing the networking stack.&lt;/P&gt;&lt;P class=""&gt;Is there an equivalent for testing an ASP.NET core API? For now I have been testing externally using postman/Newman to get closer to reality. Is that a common approach or are there benefits of integrated tests?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 04:07:06 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/is-there-an-equivalent-of-the-mockMvc-class-for-dotnet/m-p/83617#M52736</guid>
      <dc:creator>JackToncatrina</dc:creator>
      <dc:date>2022-08-03T04:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: is there an equivalent of the mockMvc class for dotnet integration testing</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/is-there-an-equivalent-of-the-mockMvc-class-for-dotnet/m-p/83626#M52742</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Integration tests ensure that an app's components function correctly at a level that includes the app's supporting infrastructure, such as the database, file system, and network. ASP.NET Core supports integration tests using a unit test framework with a test web host and an in-memory test server.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 15:05:54 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/is-there-an-equivalent-of-the-mockMvc-class-for-dotnet/m-p/83626#M52742</guid>
      <dc:creator>Obrien45050</dc:creator>
      <dc:date>2022-08-03T15:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: is there an equivalent of the mockMvc class for dotnet integration testing</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/is-there-an-equivalent-of-the-mockMvc-class-for-dotnet/m-p/84133#M53044</link>
      <description>&lt;P&gt;The problem is that if I use the code below, it still executing the Program.cs which in my case has custom middleware that I dont want executed in my tests. How do I go about to create a custom Program class, that DONT execute my main Program.cs:&lt;/P&gt;&lt;PRE&gt;public async Task HelloWorldTest()
{
    var application = new WebApplicationFactory&amp;lt;Program&amp;gt;()
        .WithWebHostBuilder(builder =&amp;gt;
        {
            // ... Configure test services
        });

    var _client = application.CreateClient();
    var response = await _client.GetAsync("localhost://home");
}```

Reference: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0&amp;amp;viewFallbackFrom=aspnetcore-2.2&lt;/PRE&gt;&lt;P&gt;Check out the documentation on integration tests and mock up your "custom middleware".&lt;/P&gt;&lt;P&gt;Documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0&lt;/A&gt;&amp;nbsp;&lt;A href="https://e-chats.com/omegle" target="_blank" rel="noopener"&gt;/echat&lt;/A&gt;&lt;A href="https://chatspin.download" target="_blank" rel="noopener"&gt;spin&lt;/A&gt; &lt;A href="https://echat.date" target="_blank" rel="noopener"&gt;/echat&lt;/A&gt;&lt;A href="https://chatrandom.download/omegle/" target="_blank" rel="noopener"&gt;random&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;I hope this helped you some on the way.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 11:57:29 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/is-there-an-equivalent-of-the-mockMvc-class-for-dotnet/m-p/84133#M53044</guid>
      <dc:creator>JackToncatrina</dc:creator>
      <dc:date>2022-09-14T11:57:29Z</dc:date>
    </item>
  </channel>
</rss>

