{"id":981,"date":"2025-12-15T10:22:03","date_gmt":"2025-12-15T10:22:03","guid":{"rendered":"https:\/\/oussamasaidi.com\/?p=981"},"modified":"2025-12-20T11:14:43","modified_gmt":"2025-12-20T11:14:43","slug":"net-8-testing-libraries-complete-guide-for-developers","status":"publish","type":"post","link":"https:\/\/oussamasaidi.com\/en\/net-8-testing-libraries-complete-guide-for-developers\/","title":{"rendered":"Best .NET 8 Testing Libraries: The Complete Guide for Developers"},"content":{"rendered":"<ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-introduction-1\">Introduction<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-testing-matters-more-than-ever-in-net-8-6\">Why Testing Matters More Than Ever in .NET 8<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-types-of-tests-in-net-applications-23\">Types of Tests in .NET Applications<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-unit-tests-25\">Unit Tests<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-integration-tests-32\">Integration Tests<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-end-to-end-e2e-tests-39\">End-to-End (E2E) Tests<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-1-xunit-the-most-popular-net-testing-framework-47\">1. xUnit \u2013 The Most Popular .NET Testing Framework<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-xunit-is-a-top-choice-48\">Why xUnit Is a Top Choice<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-installing-xunit-in-net-8-57\">Installing xUnit in .NET 8<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-writing-your-first-xunit-test-59\">Writing Your First xUnit Test<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-xunit-works-well-for-professionals-62\">Why xUnit Works Well for Professionals<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-2-nunit-a-mature-and-feature-rich-alternative-69\">2. NUnit \u2013 A Mature and Feature-Rich Alternative<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-when-to-choose-nunit-70\">When to Choose NUnit<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-installing-nunit-78\">Installing NUnit<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-nunit-vs-xunit-82\">NUnit vs xUnit<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-3-mstest-microsofts-official-testing-framework-86\">3. MSTest \u2013 Microsoft\u2019s Official Testing Framework<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-mstest-still-matters-87\">Why MSTest Still Matters<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-installing-mstest-95\">Installing MSTest<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-when-to-use-mstest-99\">When to Use MSTest<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-4-fluentassertions-write-tests-that-read-like-english-105\">4. FluentAssertions \u2013 Write Tests That Read Like English<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-fluentassertions-improves-readability-106\">Why FluentAssertions Improves Readability<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-installing-fluentassertions-108\">Installing FluentAssertions<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-5-moq-the-most-popular-mocking-library-120\">5. Moq \u2013 The Most Popular Mocking Library<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-mocking-is-essential-121\">Why Mocking Is Essential<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-installing-moq-124\">Installing Moq<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-6-nsubstitute-a-cleaner-alternative-to-moq-132\">6. NSubstitute \u2013 A Cleaner Alternative to Moq<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-some-developers-prefer-nsubstitute-133\">Why Some Developers Prefer NSubstitute<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-installing-nsubstitute-135\">Installing NSubstitute<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-7-bogus-generate-realistic-test-data-141\">7. Bogus \u2013 Generate Realistic Test Data<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-test-data-matters-142\">Why Test Data Matters<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-installing-bogus-144\">Installing Bogus<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-8-webapplicationfactory-integration-testing-for-asp-net-core-148\">8. WebApplicationFactory \u2013 Integration Testing for ASP.NET Core<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-integration-tests-are-critical-149\">Why Integration Tests Are Critical<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-example-integration-test-152\">Example Integration Test<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-9-playwright-end-to-end-testing-for-net-155\">9. Playwright \u2013 End-to-End Testing for .NET<\/a><ul><li><a class=\"aioseo-toc-item\" href=\"#aioseo-why-playwright-is-a-game-changer-156\">Why Playwright Is a Game-Changer<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-installing-playwright-164\">Installing Playwright<\/a><\/li><\/ul><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-recommended-testing-stack-for-net-8-173\">Recommended Testing Stack for .NET 8<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-best-practices-for-net-8-testing-183\">Best Practices for .NET 8 Testing<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-conclusion-192\">Conclusion<\/a><\/li><li><a class=\"aioseo-toc-item\" href=\"#aioseo-must-read-198\">Must read<\/a><\/li><\/ul>\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-introduction-1\">Introduction<\/h2>\n\n\n\n<p><strong><a href=\"https:\/\/oussamasaidi.com\/en\/domain-driven-design-clean-architecture-for-dot-net-core\/\" title=\".Net 8 Domain Driven Design l\u2019Architecture Propre et simple\">.NET 8<\/a> testing libraries<\/strong> play a critical role in building reliable, maintainable, and high-performance applications in today\u2019s software landscape. As .NET continues to evolve, the tools available for testing have become more powerful, expressive, and developer-friendly. However, choosing the right testing libraries \u2014 and knowing how to use them correctly \u2014 remains a real challenge for many developers.<\/p>\n\n\n\n<p>In modern .NET 8 projects, testing is no longer just about catching bugs. Instead, it is a fundamental practice that improves code quality, supports safe refactoring, and enables confident deployments. Whether you are working on ASP.NET Core APIs, background services, or cloud-native applications, a solid testing strategy is essential.<\/p>\n\n\n\n<p>That is exactly why this guide exists. In this article, we will explore the <strong>best<a href=\"https:\/\/oussamasaidi.com\/en\/domain-driven-design-clean-architecture-for-dot-net-core\/\" title=\".Net 8 Domain Driven Design l\u2019Architecture Propre et simple\"> .NET 8 testing<\/a> libraries<\/strong>, explain when and why to use each one, and demonstrate their usage with <strong>clear, real-world C# examples<\/strong>. More importantly, this tutorial is written from an expert, practical perspective \u2014 focusing on what actually works in professional .NET environments, not just theory.<\/p>\n\n\n\n<p>By the end of this guide, you will have a clear understanding of the modern .NET testing ecosystem and the confidence to build testable, production-ready applications with .NET 8.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-why-testing-matters-more-than-ever-in-net-8-6\">Why Testing Matters More Than Ever in .NET 8<\/h2>\n\n\n\n<p>Before diving into libraries, it is important to understand <strong>why testing is critical<\/strong> today.<\/p>\n\n\n\n<p>With .NET 8, Microsoft has delivered:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Faster runtime performance<\/li>\n\n\n\n<li>Improved ASP.NET Core hosting<\/li>\n\n\n\n<li>Better minimal APIs<\/li>\n\n\n\n<li>Enhanced cloud-native capabilities<\/li>\n<\/ul>\n\n\n\n<p>However, faster development also means <strong>faster bugs<\/strong> if testing is neglected.<\/p>\n\n\n\n<p>Testing helps you:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Detect bugs early<\/li>\n\n\n\n<li>Refactor code safely<\/li>\n\n\n\n<li>Improve architecture and design<\/li>\n\n\n\n<li>Reduce production incidents<\/li>\n\n\n\n<li>Increase team confidence<\/li>\n<\/ul>\n\n\n\n<p>As a result, professional .NET teams rely heavily on <strong>automated tests<\/strong> rather than manual testing. qui rendent l&rsquo;ex\u00e9cution des tests plus rapide, notamment gr\u00e2ce aux am\u00e9liorations du compilateur et du runtime.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-types-of-tests-in-net-applications-23\">Types of Tests in .NET Applications<\/h2>\n\n\n\n<p>To choose the right libraries, you must first understand the <strong>types of tests<\/strong> you will write.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-unit-tests-25\">Unit Tests<\/h3>\n\n\n\n<p>Unit tests validate small pieces of code, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Methods<\/li>\n\n\n\n<li>Classes<\/li>\n\n\n\n<li>Business logic<\/li>\n<\/ul>\n\n\n\n<p>They are fast, isolated, and run frequently.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-integration-tests-32\">Integration Tests<\/h3>\n\n\n\n<p>Integration tests verify how components work together:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Controllers + services<\/li>\n\n\n\n<li>Services + database<\/li>\n\n\n\n<li>APIs + external dependencies<\/li>\n<\/ul>\n\n\n\n<p>They are slower than unit tests but more realistic.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-end-to-end-e2e-tests-39\">End-to-End (E2E) Tests<\/h3>\n\n\n\n<p>These tests simulate real user behavior:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>HTTP requests<\/li>\n\n\n\n<li>UI interactions<\/li>\n\n\n\n<li>Full application flow<\/li>\n<\/ul>\n\n\n\n<p>They provide the highest confidence but are the slowest.<\/p>\n\n\n\n<p>With this foundation, let\u2019s explore the <strong>best <strong><a href=\"https:\/\/oussamasaidi.com\/en\/domain-driven-design-clean-architecture-for-dot-net-core\/\" title=\".Net 8 Domain Driven Design l\u2019Architecture Propre et simple\">.NET 8 testing<\/a><\/strong> libraries<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-1-xunit-the-most-popular-net-testing-framework-47\">1. xUnit \u2013 The Most Popular .NET Testing Framework<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-why-xunit-is-a-top-choice-48\">Why xUnit Is a Top Choice<\/h3>\n\n\n\n<p>xUnit is currently the <strong>most widely used testing framework<\/strong> in modern .NET projects. In fact, many Microsoft teams use xUnit internally.<\/p>\n\n\n\n<p>Key advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Clean and modern API<\/li>\n\n\n\n<li>Excellent .NET 8 compatibility<\/li>\n\n\n\n<li>Strong community support<\/li>\n\n\n\n<li>Built-in dependency injection support<\/li>\n\n\n\n<li>Parallel test execution by default<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-installing-xunit-in-net-8-57\"><strong>Installing xUnit in .NET 8<\/strong><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dotnet add package xunit\ndotnet add package xunit.runner.visualstudio\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-writing-your-first-xunit-test-59\"><strong>Writing Your First <a href=\"https:\/\/github.com\/xunit\/xunit\" target=\"_blank\" rel=\"noopener\" title=\"\">xUnit <\/a>Test<\/strong><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class Calculator\n{\n    public int Add(int a, int b) => a + b;\n}\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class CalculatorTests\n{\n    [Fact]\n    public void Add_ShouldReturnCorrectSum()\n    {\n        \/\/ Arrange\n        var calculator = new Calculator();\n\n        \/\/ Act\n        var result = calculator.Add(2, 3);\n\n        \/\/ Assert\n        Assert.Equal(5, result);\n    }\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-why-xunit-works-well-for-professionals-62\">Why xUnit Works Well for Professionals<\/h3>\n\n\n\n<p>xUnit encourages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Clean test naming<\/li>\n\n\n\n<li>Separation of concerns<\/li>\n\n\n\n<li>Maintainable test code<\/li>\n<\/ul>\n\n\n\n<p>Moreover, its flexibility makes it ideal for <strong>enterprise-grade applications<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-2-nunit-a-mature-and-feature-rich-alternative-69\">2. NUnit \u2013 A Mature and Feature-Rich Alternative<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-when-to-choose-nunit-70\">When to Choose NUnit<\/h3>\n\n\n\n<p>NUnit is one of the oldest testing frameworks in the .NET ecosystem. While xUnit is more modern, NUnit remains a strong choice, especially for teams migrating legacy code.<\/p>\n\n\n\n<p>Key strengths:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Attribute-rich syntax<\/li>\n\n\n\n<li>Parameterized tests<\/li>\n\n\n\n<li>Strong assertion model<\/li>\n\n\n\n<li>Stable and battle-tested<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-installing-nunit-78\">Installing NUnit<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dotnet add package NUnit\ndotnet add package NUnit3TestAdapter<\/pre>\n\n\n\n<p>Example NUnit Test<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[TestFixture]\npublic class CalculatorTests\n{\n    [Test]\n    public void Add_ReturnsCorrectResult()\n    {\n        var calculator = new Calculator();\n        var result = calculator.Add(4, 6);\n        Assert.AreEqual(10, result);\n    }\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-nunit-vs-xunit-82\">NUnit vs xUnit<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Feature<\/th><th>xUnit<\/th><th>NUnit<\/th><\/tr><\/thead><tbody><tr><td>Modern API<\/td><td>&#x2705;<\/td><td>&#x26a0;&#xfe0f;<\/td><\/tr><tr><td>Legacy Support<\/td><td>&#x26a0;&#xfe0f;<\/td><td>&#x2705;<\/td><\/tr><tr><td>Parallel Execution<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><\/tr><tr><td>Microsoft Usage<\/td><td>&#x2705;<\/td><td>&#x26a0;&#xfe0f;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>In short, <strong>both are excellent<\/strong>, but xUnit is often preferred for new projects.<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/xunit\/xunit\" target=\"_blank\" rel=\"noopener\" title=\"\">xUnit Github repos<\/a><br><a href=\"https:\/\/github.com\/nunit\/nunit\" target=\"_blank\" rel=\"noopener\" title=\"\">nUnit Github repos<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-3-mstest-microsofts-official-testing-framework-86\">3. MSTest \u2013 Microsoft\u2019s Official Testing Framework<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-why-mstest-still-matters-87\">Why MSTest Still Matters<\/h3>\n\n\n\n<p>MSTest is Microsoft\u2019s <strong>official testing framework<\/strong> and integrates deeply with Visual Studio and Azure DevOps.<\/p>\n\n\n\n<p>Key benefits:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First-class Microsoft support<\/li>\n\n\n\n<li>Excellent CI\/CD integration<\/li>\n\n\n\n<li>Simple learning curve<\/li>\n\n\n\n<li>Strong tooling support<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-installing-mstest-95\">Installing MSTest<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dotnet add package MSTest.TestFramework\ndotnet add package MSTest.TestAdapter<\/pre>\n\n\n\n<p>Example MSTest Code<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[TestClass]\npublic class CalculatorTests\n{\n    [TestMethod]\n    public void Add_ReturnsCorrectSum()\n    {\n        var calculator = new Calculator();\n        var result = calculator.Add(1, 2);\n        Assert.AreEqual(3, result);\n    }\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-when-to-use-mstest-99\">When to Use MSTest<\/h3>\n\n\n\n<p>MSTest is ideal when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You work in enterprise environments<\/li>\n\n\n\n<li>You rely heavily on Azure DevOps<\/li>\n\n\n\n<li>You prefer official Microsoft tooling<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-4-fluentassertions-write-tests-that-read-like-english-105\">4. FluentAssertions \u2013 Write Tests That Read Like English<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-why-fluentassertions-improves-readability-106\">Why FluentAssertions Improves Readability<\/h3>\n\n\n\n<p>FluentAssertions is not a testing framework. Instead, it enhances <strong>assertions<\/strong>, making tests easier to read and maintain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-installing-fluentassertions-108\">Installing FluentAssertions<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dotnet add package FluentAssertions<\/pre>\n\n\n\n<p>FluentAssertions Example<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">result.Should().Be(5);\nuser.Name.Should().NotBeNullOrEmpty();\nlist.Should().HaveCount(3);\n<\/pre>\n\n\n\n<p>Real Test Example<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[Fact]\npublic void User_ShouldHaveValidEmail()\n{\n    var user = new User(\"oussama.saidisbz@gmail.com\");\n\n    user.Email.Should().Contain(\"@\");\n}<\/pre>\n\n\n\n<p>As a result, tests become:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>More expressive<\/li>\n\n\n\n<li>Easier to review<\/li>\n\n\n\n<li>Easier to maintain<\/li>\n<\/ul>\n\n\n\n<p><a href=\"https:\/\/github.com\/fluentassertions\/fluentassertions\" target=\"_blank\" rel=\"noopener\" title=\"\">FluentAssertions  Github repos<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-5-moq-the-most-popular-mocking-library-120\">5. Moq \u2013 The Most Popular Mocking Library<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-why-mocking-is-essential-121\">Why Mocking Is Essential<\/h3>\n\n\n\n<p>In unit tests, you should <strong>isolate dependencies<\/strong>. This is where mocking libraries are essential.<\/p>\n\n\n\n<p>Moq is the most widely used mocking framework in .NET.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-installing-moq-124\">Installing Moq<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dotnet add package Moq<\/pre>\n\n\n\n<p>Moq Example<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">var repositoryMock = new Mock&lt;IUserRepository>();\n\nrepositoryMock\n    .Setup(r => r.GetUserById(1))\n    .Returns(new User(\"Oussama\"));\n<\/pre>\n\n\n\n<p>Using Moq in a Test<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[Fact]\npublic void Service_ShouldReturnUser()\n{\n    var repoMock = new Mock&lt;IUserRepository>();\n    repoMock.Setup(r => r.GetUserById(1))\n            .Returns(new User(\"John\"));\n\n    var service = new UserService(repoMock.Object);\n\n    var user = service.GetUser(1);\n\n    user.Name.Should().Be(\"John\");\n}\n<\/pre>\n\n\n\n<p>Moq works perfectly with <strong><a href=\"https:\/\/oussamasaidi.com\/en\/solid-principles-in-c-explained-definitions-examples-best-practices\/\" target=\"_blank\" rel=\"noopener\" title=\"SOLID Principles in C# Explained: Definitions, Examples &amp; Best Practices\">SOLID principles<\/a><\/strong>, especially Dependency Inversion.<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/devlooped\/moq\" target=\"_blank\" rel=\"noopener\" title=\"\">Moq Github repos<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-6-nsubstitute-a-cleaner-alternative-to-moq-132\">6. NSubstitute \u2013 A Cleaner Alternative to Moq<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-why-some-developers-prefer-nsubstitute-133\">Why Some Developers Prefer NSubstitute<\/h3>\n\n\n\n<p>NSubstitute focuses on simplicity and readability.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-installing-nsubstitute-135\">Installing NSubstitute<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dotnet add package NSubstitute<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">NSubstitute Example<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">var repository = Substitute.For&lt;IUserRepository>();\nrepository.GetUserById(1).Returns(new User(\"Jane\"));\n<\/pre>\n\n\n\n<p>Many developers find this syntax more natural and expressive.<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/nsubstitute\/NSubstitute\" target=\"_blank\" rel=\"noopener\" title=\"\">NSubstitute Github repos<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-7-bogus-generate-realistic-test-data-141\">7. Bogus \u2013 Generate Realistic Test Data<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-why-test-data-matters-142\">Why Test Data Matters<\/h3>\n\n\n\n<p>Hardcoded test data can become unrealistic and brittle. Bogus solves this by generating <strong>fake but realistic data<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-installing-bogus-144\">Installing Bogus<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dotnet add package Bogus\n<\/pre>\n\n\n\n<p>Example Using Bogus<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">var faker = new Faker&lt;User>()\n    .RuleFor(u => u.Name, f => f.Name.FullName())\n    .RuleFor(u => u.Email, f => f.Internet.Email());\n\nvar user = faker.Generate();\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-8-webapplicationfactory-integration-testing-for-asp-net-core-148\">8. WebApplicationFactory \u2013 Integration Testing for ASP.NET Core<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-why-integration-tests-are-critical-149\">Why Integration Tests Are Critical<\/h3>\n\n\n\n<p>Unit tests alone are not enough. You must verify how your application behaves as a whole.<\/p>\n\n\n\n<p>ASP.NET Core provides <code>WebApplicationFactory&lt;T&gt;<\/code> for this purpose.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-example-integration-test-152\">Example Integration Test<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class UsersApiTests : IClassFixture&lt;WebApplicationFactory&lt;Program>>\n{\n    private readonly HttpClient _client;\n\n    public UsersApiTests(WebApplicationFactory&lt;Program> factory)\n    {\n        _client = factory.CreateClient();\n    }\n\n    [Fact]\n    public async Task GetUsers_ReturnsOk()\n    {\n        var response = await _client.GetAsync(\"\/api\/users\");\n\n        response.StatusCode.Should().Be(HttpStatusCode.OK);\n    }\n}\n<\/pre>\n\n\n\n<p>This approach closely mirrors real production behavior.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-9-playwright-end-to-end-testing-for-net-155\">9. Playwright \u2013 End-to-End Testing for .NET<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-why-playwright-is-a-game-changer-156\">Why Playwright Is a Game-Changer<\/h3>\n\n\n\n<p>Playwright enables reliable browser automation and E2E testing.<\/p>\n\n\n\n<p>Key advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Cross-browser support<\/li>\n\n\n\n<li>Fast execution<\/li>\n\n\n\n<li>Modern API<\/li>\n\n\n\n<li>Excellent .NET integration<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aioseo-installing-playwright-164\">Installing Playwright<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dotnet add package Microsoft.Playwright\n<\/pre>\n\n\n\n<p>Example Playwright Test<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">await page.GotoAsync(\"https:\/\/localhost:5001\");\nawait page.ClickAsync(\"#login\");\nawait page.FillAsync(\"#email\", \"test@example.com\");\nawait page.ClickAsync(\"#submit\");\n<\/pre>\n\n\n\n<p>Playwright is ideal for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Critical user journeys<\/li>\n\n\n\n<li>Regression testing<\/li>\n\n\n\n<li>UI validation<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-recommended-testing-stack-for-net-8-173\">Recommended Testing Stack for .NET 8<\/h2>\n\n\n\n<p>For most professional projects, I recommend:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>xUnit<\/strong> \u2192 Test framework<\/li>\n\n\n\n<li><strong>FluentAssertions<\/strong> \u2192 Assertions<\/li>\n\n\n\n<li><strong>Moq or NSubstitute<\/strong> \u2192 Mocking<\/li>\n\n\n\n<li><strong>Bogus<\/strong> \u2192 Test data<\/li>\n\n\n\n<li><strong>WebApplicationFactory<\/strong> \u2192 Integration tests<\/li>\n\n\n\n<li><strong>Playwright<\/strong> \u2192 E2E tests<\/li>\n<\/ul>\n\n\n\n<p>This stack balances <strong>speed, readability, and confidence<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-best-practices-for-net-8-testing-183\">Best Practices for .NET 8 Testing<\/h2>\n\n\n\n<p>To maximize value, always:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Keep tests fast<\/li>\n\n\n\n<li>Avoid testing implementation details<\/li>\n\n\n\n<li>Name tests clearly<\/li>\n\n\n\n<li>Use Arrange \/ Act \/ Assert<\/li>\n\n\n\n<li>Run tests in CI pipelines<\/li>\n\n\n\n<li>Treat tests as production code<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aioseo-conclusion-192\">Conclusion<\/h2>\n\n\n\n<p>Testing in .NET 8 is powerful, mature, and developer-friendly. Thanks to the rich ecosystem of libraries, you can build <strong>robust, maintainable, and scalable applications<\/strong> with confidence.<\/p>\n\n\n\n<p>By choosing the right testing tools and applying best practices, you not only reduce bugs but also improve architecture, collaboration, and long-term success.<\/p>\n\n\n\n<p>If you take one thing from this guide, let it be this:<br><strong>Great .NET applications are tested applications.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"572\" src=\"https:\/\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/best-dot-net-8-testing-libraries-2-1024x572.png\" alt=\"Best .NET 8 Testing Libraries\" class=\"wp-image-1607\" srcset=\"https:\/\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/best-dot-net-8-testing-libraries-2-1024x572.png 1024w, https:\/\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/best-dot-net-8-testing-libraries-2-300x167.png 300w, https:\/\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/best-dot-net-8-testing-libraries-2-768x429.png 768w, https:\/\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/best-dot-net-8-testing-libraries-2-18x10.png 18w, https:\/\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/best-dot-net-8-testing-libraries-2-256x143.png 256w, https:\/\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/best-dot-net-8-testing-libraries-2-950x530.png 950w, https:\/\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/best-dot-net-8-testing-libraries-2.png 1376w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-jetpack-related-posts\">\n<h2 class=\"wp-block-heading\" id=\"aioseo-must-read-198\">Must read<\/h2>\n<\/div>\n\n\n\n<div class=\"buy-coffee-container\">\n<p style=\"text-align:center; color:#555; font-size:14px;\">\n  If this article helped you, consider supporting my work.\n<\/p>\n  <a\n    href=\"https:\/\/buymeacoffee.com\/oussamasaii\"\n    target=\"_blank\"\n    rel=\"noopener noreferrer\"\n    class=\"buy-coffee-button\"\n  >\n    &#x2615; Buy me a coffee\n  <\/a>\n<\/div>\n\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction .NET 8 testing libraries play a critical role in building reliable, maintainable, and high-performance applications in today\u2019s software landscape&#8230;. <\/p>\n<div class=\"art-el-more\"><a href=\"https:\/\/oussamasaidi.com\/en\/net-8-testing-libraries-complete-guide-for-developers\/\" class=\"art-link art-color-link art-w-chevron\">Read more<\/a><\/div>","protected":false},"author":1,"featured_media":1608,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[40,68,45,41,56,90,84,92,1,91],"tags":[],"ppma_author":[286],"class_list":["post-981","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-netcore","category-api","category-asp-net","category-c","category-c-2","category-devops","category-ef-core","category-test","category-uncategorized","category-unit-test"],"acf":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/best-dot-net-8-testing-libraries.png","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1406,"url":"https:\/\/oussamasaidi.com\/en\/net-8-test-driven-design-architecture-7-proven-patterns-to-build-robust-maintainable-systems\/","url_meta":{"origin":981,"position":0},"title":"Net 8 Test Driven Design Architecture 7 Proven Patterns to Build Robust, Maintainable Systems","author":"Saidi Oussama","date":"November 25, 2025","format":false,"excerpt":"Introduction to Test Driven Design \u2014 What this guide covers If you want a battle-tested approach to designing systems that are maintainable, testable, and production-ready, .Net 8 Test Driven Design Architecture combines the stability of .NET 8 with Test Driven Design discipline and modern architecture patterns. This guide gives patterns,\u2026","rel":"","context":"In &quot;.Net Core&quot;","block_context":{"text":".Net Core","link":"https:\/\/oussamasaidi.com\/en\/category\/netcore\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/dot-net-8-tdd-architecture-article-cover.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/dot-net-8-tdd-architecture-article-cover.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/dot-net-8-tdd-architecture-article-cover.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/dot-net-8-tdd-architecture-article-cover.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/dot-net-8-tdd-architecture-article-cover.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/dot-net-8-tdd-architecture-article-cover.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1714,"url":"https:\/\/oussamasaidi.com\/en\/https-oussamasaidi-com-restful-api-mastery-best-practices-with-asp-net-core-part-2\/","url_meta":{"origin":981,"position":1},"title":"RESTful API best practices\u00a0with ASP.NET Core Part 2","author":"Saidi Oussama","date":"December 20, 2025","format":false,"excerpt":"Testing, Performance, Security, Microservices & Deployment Introduction: From Solid Foundations to Production Excellence In Part 1 of RESTful API Mastery, we established the architectural and technical foundations required to build reliable, evolvable RESTful APIs with ASP.NET Core. However, a well-designed API only becomes truly valuable when it is tested, observable,\u2026","rel":"","context":"In &quot;.Net Core&quot;","block_context":{"text":".Net Core","link":"https:\/\/oussamasaidi.com\/en\/category\/netcore\/"},"img":{"alt_text":"RESTful API Mastery","src":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-2r.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-2r.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-2r.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-2r.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-2r.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-2r.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1325,"url":"https:\/\/oussamasaidi.com\/en\/building-professional-modern-api-documentation-in-net-core-with-scalar\/","url_meta":{"origin":981,"position":2},"title":"Building Professional, Modern API Documentation in .NET Core with Scalar","author":"Saidi Oussama","date":"November 19, 2025","format":false,"excerpt":"Introduction In today\u2019s software ecosystem, APIs are everywhere. Whether you are building a mobile application, a microservices architecture, or an internal company platform, your API is often the backbone of the system. But even the best API becomes useless if developers cannot understand how to consume it. This is why\u2026","rel":"","context":"In &quot;.Net Core&quot;","block_context":{"text":".Net Core","link":"https:\/\/oussamasaidi.com\/en\/category\/netcore\/"},"img":{"alt_text":"Building Professional, Modern API Documentation in .NET Core with Scalar","src":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/Building-Professional-Modern-API-Documentation-in-.NET-Core-with-Scalar.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/Building-Professional-Modern-API-Documentation-in-.NET-Core-with-Scalar.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/Building-Professional-Modern-API-Documentation-in-.NET-Core-with-Scalar.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/Building-Professional-Modern-API-Documentation-in-.NET-Core-with-Scalar.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/Building-Professional-Modern-API-Documentation-in-.NET-Core-with-Scalar.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/Building-Professional-Modern-API-Documentation-in-.NET-Core-with-Scalar.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1639,"url":"https:\/\/oussamasaidi.com\/en\/restful-api-mastery-best-practices-with-asp-net-core\/","url_meta":{"origin":981,"position":3},"title":"RESTful API Best Practices with ASP.NET Core","author":"Saidi Oussama","date":"December 16, 2025","format":false,"excerpt":"Professional Best Practices, Versioning Strategies & Advanced Serialization (Part 1) In this blog Introduction: Building Enterprise-Grade RESTful APIs with ASP.NET Core1. RESTful APIs in the Modern ASP.NET Core EcosystemWhy REST Still Dominates2. REST Architectural Constraints Every ASP.NET Core API Must EnforceClient\u2013Server SeparationStatelessnessUniform Interface3. Establishing a Clean and Scalable ASP.NET Core\u2026","rel":"","context":"In &quot;.Net Core&quot;","block_context":{"text":".Net Core","link":"https:\/\/oussamasaidi.com\/en\/category\/netcore\/"},"img":{"alt_text":"RESTful API Mastery","src":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-cover-scaled.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-cover-scaled.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-cover-scaled.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-cover-scaled.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-cover-scaled.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/restful-api-mastery-best-practices-with-asp-net-core-cover-scaled.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1254,"url":"https:\/\/oussamasaidi.com\/en\/how-to-build-an-idempotent-api-with-net-9-ef-core-9-and-polly-v8\/","url_meta":{"origin":981,"position":4},"title":"How to Build an Idempotent API with .NET 9, EF Core 9 and Polly v8","author":"Saidi Oussama","date":"November 6, 2025","format":false,"excerpt":"Introduction Have you ever hit \u201cPay\u201d on a checkout page, the page froze, and you clicked again \u2014 only to be charged twice?That\u2019s exactly what idempotency prevents. In distributed and cloud-native architectures, duplicate requests happen often: client-side retries (mobile poor signal), API Gateway or load-balancer retries, users refreshing a browser\u2026","rel":"","context":"In &quot;.Net Core&quot;","block_context":{"text":".Net Core","link":"https:\/\/oussamasaidi.com\/en\/category\/netcore\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/oussama-saidi-tuto-net-core-rest-api-Idempotent-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/oussama-saidi-tuto-net-core-rest-api-Idempotent-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/oussama-saidi-tuto-net-core-rest-api-Idempotent-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/oussama-saidi-tuto-net-core-rest-api-Idempotent-1.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/oussama-saidi-tuto-net-core-rest-api-Idempotent-1.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/11\/oussama-saidi-tuto-net-core-rest-api-Idempotent-1.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1783,"url":"https:\/\/oussamasaidi.com\/en\/react-19-and-vite-for-dotnet-developers-build-fast-modern-frontends\/","url_meta":{"origin":981,"position":5},"title":"React 19 &amp; Vite: Build Fast Frontends for .NET Developers","author":"Saidi Oussama","date":"December 23, 2025","format":false,"excerpt":"Introduction: Why .NET Developers Need Modern Frontend Tools For many years, ASP.NET developers have focused mainly on server-side rendering using technologies like ASP.NET MVC, Razor Pages, and Blazor. While these frameworks remain powerful, the modern web has evolved rapidly. Today, users expect instant load times, smooth UI interactions, and app-like\u2026","rel":"","context":"In &quot;Non class\u00e9&quot;","block_context":{"text":"Non class\u00e9","link":"https:\/\/oussamasaidi.com\/en\/category\/non-classe-fr\/"},"img":{"alt_text":"react-19-and-vite-for-dotnet-developers-build-fast-modern-frontends","src":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/react-19-and-vite-for-dotnet-developers-build-fast-modern-frontends-scaled.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/react-19-and-vite-for-dotnet-developers-build-fast-modern-frontends-scaled.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/react-19-and-vite-for-dotnet-developers-build-fast-modern-frontends-scaled.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/react-19-and-vite-for-dotnet-developers-build-fast-modern-frontends-scaled.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/react-19-and-vite-for-dotnet-developers-build-fast-modern-frontends-scaled.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/oussamasaidi.com\/wp-content\/uploads\/2025\/12\/react-19-and-vite-for-dotnet-developers-build-fast-modern-frontends-scaled.png?resize=1400%2C800&ssl=1 4x"},"classes":[]}],"authors":[{"term_id":286,"user_id":1,"is_guest":0,"slug":"oussama_sa","display_name":"Saidi Oussama","avatar_url":{"url":"https:\/\/oussamasaidi.com\/wp-content\/uploads\/2022\/02\/001_001_cv1.jpg","url2x":"https:\/\/oussamasaidi.com\/wp-content\/uploads\/2022\/02\/001_001_cv1.jpg"},"author_category":"1","first_name":"Oussama","last_name":"SAIDI","user_url":"https:\/\/oussamasaidi.com","job_title":"Senior Fullstack .NET Developer","description":"I\u2019m a Senior Fullstack .NET Developer specializing in building scalable, high-performance web applications with .NET, C#, and modern frontend frameworks like React.js. I\u2019m passionate about clean architecture, automated testing, and sharing knowledge through blogs and tutorials."}],"_links":{"self":[{"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/posts\/981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/comments?post=981"}],"version-history":[{"count":40,"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/posts\/981\/revisions"}],"predecessor-version":[{"id":1703,"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/posts\/981\/revisions\/1703"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/media\/1608"}],"wp:attachment":[{"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/media?parent=981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/categories?post=981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/tags?post=981"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/oussamasaidi.com\/en\/wp-json\/wp\/v2\/ppma_author?post=981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}