It's not quite as simple as handling a GET request. 10/21/2020; 4 minutes de lecture; a; o; O; Dans cet article. Expand the Project dependencies, it will show the packages used in the test project as shown in figure 3. var controller = new CategoryController(mockRepo.Object); dotnet test démarre le testeur de test à l’aide du projet de test unitaire.dotnet test starts the test runner using the unit test project. this.catService = catService; } Unit Testing .Net Core 3 Applications with xUnit .net & MOQ Udemy Free download. As shown in figure 3, we have the UnitTest1.cs file. var result = controller.Index().Result; As usual, you'll need to add a reference to your test project that points to the project with the code you want to test. And, we will look at how we can handle a POST request in TestServer. } mockRepo.Setup(repo => repo.CreateAsync(It.IsAny, ())) ASP.NET Core 3.1 Unit Testing using xUnit and Moq Tweet: In any software life-cycle, Testing is an important step for ensuring a good quality software application. 17.8k 41 41 gold badges 135 135 silver badges 242 242 bronze badges. Photo by Joyce McCown on Unsplash Introduction and prerequisites. var cat = await catService.GetAsync(id); Une approche courante du développement piloté par les tests (TDD) consiste à écrire un test avant d’implémenter le code cible.A popular approach in test driven development (TDD) is to write a test before implementing the target code. Create an xUnit project in Visual Studio 2019. So we have added 3 test methods in the Test class. Le test échoue car IsPrime n’a pas été implémenté.The test fails because IsPrime hasn't been implemented. That choice will give you a project with a default class (UnitTest1), which you'll want to rename. This article explains how to mock the HttpClient using XUnit. In the software applications, we have the following major testing types: Unit Testing is the most popular testing methodology. } Test de la logique de contrôleur dans ASP.NET Core, Afficher tous les commentaires de la page, Affichez ou téléchargez l’exemple de code, commandes pour créer une solution de test, implémentation complète de la bibliothèque. Pour suivre le didacticiel à l’aide d’une solution prédéfinie, Affichez ou téléchargez l’exemple de code.To follow the tutorial using a pre-built solution, view or download the sample code. Before we do anything else, we need to make sure that we reference any projects that we are testing in our xUnit project. return View(new Category()); if (c != null) 05/18/2020; 4 … First, we will look at a solution where we are able to access the TestServer's DbContext instance from within a test. Le test réussit.The test passes. En este tutorial se muestra cómo compilar una solución que contiene un proyecto de prueba unitaria y un proyecto de código fuente. Write the code in this method as shown in listing 8. .Verifiable(); TestDriven.net fonctionne bien mais mentionne quelque chose à propos de Ad hoc: 1 réussi, 0 échoué, 0 ignoré (voir 'Liste des tâches'), a pris 0.47 secondes (Ad hoc) TeamCity, xunit.gui.exe et xunit.console.exe et Visual Studio ne peuvent pas non plus trouver TestMethod (J'ai xunit.runner.visualstudio installé et VS voit quelques tests.) Configures the test runner by adding the following. For example, xUnit in this article has already provided a support version for. { } { Try xunit.analyzers project and run tests which are there. { That's the xUnit project set up. if (ModelState.IsValid) The CategoryService class uses AppJune2020DbContext class to perform CRUD operations. return Ok(cat); Ouvrez une fenêtre d’interpréteur de commandes. xUnit is a free, open-source, testing tool for .NET which developers use to write tests for their applications. In this section, a solution is created that contains the source and test projects. The Act part of the method makes call to PostAsync() method of the CategoryAPIController class. We will use this class file to write test for action methods in CategoryController and CategoryAPIController classes. var res = await catService.DeleteAsync(id); The important part in the code of listing 11 is the the Model error on the CategoryName property of the Category class. [HttpPut("id")] The code in listing 8 performs following operations: The Mock instance is created using the IService interface. { In one of my previous articles, Using jQuery to Delete a Row in a Table by just Clicking on it I showed you how to delete a Table Row. Written by the original inventor of NUnit v2, xUnit.net is the latest technology for unit testing C#, F#, VB.NET and other .NET languages. In any software life-cycle, Testing is an important step for ensuring a good quality software application. La nouvelle bibliothèque de classes contiendra le code à tester.The new class library will contain the code to be tested. catch (Exception ex) xUnit is a free, open-source, community-focused unit testing tool for the .NET Framework. More information about xUnit can be read from, To add a Unit Test project in the current solution, right-click on the solution and select. xUnit allows writing data using the ITestOutputHelper interface. He is a Microsoft Certified Trainer (MCT) since 2005 and has conducted various Corporate Training programs for .NET Technologies (all versions). }, >(); Since we will be testing Index() method returning ViewResult with List of Categories, the test method name is Index_ReturnsViewResult_WithAListOfCategories(). Remplacez le code dans PrimeService.cs par le code suivant :Replace the code in PrimeService.cs with the following code: Le code précédent :The preceding code: Dans le répertoire Unit-testing-using-dotnet-test , exécutez la commande suivante pour ajouter le projet de bibliothèque de classes à la solution :In the unit-testing-using-dotnet-test directory, run the following command to add the class library project to the solution: Créez le projet PrimeService. Written by the original inventor of NUnit v2, xUnit.net is the latest technology for unit testing C#, F#, VB.NET and other.NET languages. If your application logs data using the ILogger interface, such as an ASP.NET Core application, it would be nice to see them in the test output. La nouvelle bibliothèque de classes contiendra le code à tester. xUnit.net works with ReSharper, CodeRush, TestDriven.NET and Xamarin. Select the project as shown in the figure 5, Since the Controllers (MVC and API) are constructor injected using IService type, to instantiate the Controller class, we need to mock the IService interface. { Usage. var cats = await catService.GetAsync(); { }, (options => { You can, The application has repository service classes which implement the IService interface. mockRepo.Verify(); Ajoutez des tests de nombre premier pour 0 et-1. Ce didacticiel montre comment générer une solution contenant un projet de test unitaire et un projet de code source.This tutorial shows how to build a solution containing a unit test project and source code project. return View("Error"); Let's test Index() action method from the CategoryController class to test if this method returns ViewResult with List class. } [HttpPost] We can do unit testing with the xUnit tool in ASP.NET Core. var cat = await catService.GetAsync(id); return RedirectToAction("Index"); Typically, in case of web applications, testing plays an important role. Assert.IsType, download the code of an ASP.NET Core application, How to Refresh/Reload a Page using jQuery, 10 Free Tools to Load/Stress Test Your Web Applications, Execute JavaScript function from ASP.NET codebehind, What is the AntiForgeryToken and why do I need it? La solution terminée présente la structure de répertoire suivante : The completed solution has the following directory structure: Les instructions suivantes fournissent les étapes permettant de créer la solution de test. Name this project as CoreNetAppTest. public async Task, Index() Listing 3  shows code for CategoryService class: The CategoryService class and AppJune2020DbContext classes are registered in dependency container in ConfigureServices() method of the Startup class as shown in listing 4, Since we will be unit testing the ASP.NET Core MVC controller and API Controller, the code of these two classes are shown in listing 5 and listing 6, To write unit tests, we will use xUnit and the Moq frameworks. } By convention your test projects should reside in a subfolder, test, of the root folder. This will start the test debugging, we can see the mock object created using IService as shown in figure 8. All these operations are asynchronous operations. [Theory] – attribute implies that we are going to send some parameters to our testing code. { Once debugging is done, the Test Explorer will show the test result as shown in figure 9. // define the setup on the mocked type Avec TDD, un test est écrit et connu comme ayant échoué.With TDD, a test is written that is known to fail. } c.BasePrice = entity.BasePrice; - ASP.NET MVC 101 series, 5 jQuery Calendar Plugins that can be used on Websites, Hide a Table Column with a Single line of jQuery code, Create a Simple Image Slide Show using jQuery, ASP.NET MVC - Using Resource Files to Manage String Constants, File Upload using ASP.NET Core WEB API 3.1 and React.js Client Application, Visual Studio: Remove Unused References and Assemblies from your Project, Disable Squiggly or Wavy lines in Visual Studio, Routing in React.js Single Page Application using React-Router-Dom, Using Mongoose Framework to Access Azure Cosmos DB MongoDB API, ASP.NET Core 3.1 Unit Testing using xUnit and Moq, Accessing Azure Table Storage in Node.js Applications. This tutorial shows how to build a solution containing a unit test project and source code project. services.AddScoped, CategoryRepository>, catService) new Category(){CategoryRowId=2, CategoryId="Cat0002",CategoryName="Electrical",BasePrice=20 } var viewResult = Assert.IsType, (result); La IsPrime méthode peut être appelée, mais elle n’est pas implémentée.The IsPrime method is callable, but not implemented. When you create a default project in Visual Studio, there are a couple of references and assemblies that get added by default. So, the solution is to provide an implementation of } { { var redirectToActionResult = Assert.IsType, (result); Ce didacticiel utilise l’approche TDD.This tutorial uses the TDD approach. Vous pouvez copier le test précédent et modifier le code suivant pour utiliser 0 et-1 : You could copy the preceding test and change the following code to use 0 and -1: La copie du code de test lorsque seul un paramètre change entraîne la duplication du code et l’augmentation des tests. Assert.Equal("Index", redirectToActionResult.ActionName); }, catService; var c = await ctx.Categories.FindAsync(id); Prueba unitaria de C# en .NET Core mediante pruebas de dotnet y xUnit Unit testing C# in .NET Core using dotnet test and xUnit. Une approche courante du développement piloté par les tests (TDD) consiste à écrire un test avant d’implémenter le code cible. public IActionResult Create() Un appel de test à IsPrime échoue.A test call to IsPrime fails. 10/21/2020; Tiempo de lectura: 4 minutos; a; o; O; En este artículo. var model = Assert.IsAssignableFrom, >( Pour que tous les tests réussissent, mettez à jour la, To make all of the tests pass, update the. return true; { { La IsPrime méthode terminée n’est pas un algorithme efficace pour tester primality.The completed IsPrime method is not an efficient algorithm for testing primality. tests :Update the PrimeService.Tests project: L' [Fact] attribut déclare une méthode de test qui est exécutée par Test Runner.The [Fact] attribute declares a test method that's run by the test runner. // Assert the model count La solution terminée présente la structure de répertoire suivante :The completed solution has the following directory structure: Les instructions suivantes fournissent les étapes permettant de créer la solution de test.The following instructions provide the steps to create the test solution. (Note: Since the article focuses on Unit Testing, the steps for creating the ASP.NET Core application are omitted. return View(cats); xUnit is an open source test framework and the main focus of this framework is on extensibility and flexibility. À l’aide de l’approche TDD, écrivez uniquement le code suffisant pour que ce test soit réussi. Assert.Equal(2, model.Count()); var controller = new CategoryAPIController(mockRepo.Object); The directory and file structure thus far should be as follows:Make PrimeService the current directory and run dotnet new classlib to create the source project. xUnit is an open-source unit testing tool for the .Net Framework and offers .NET Core support. Vous continuez à répéter cette approche, en écrivant un test qui a échoué, puis en mettant à jour le code cible pour qu’il réussisse.You keep repeating this approach, writing a failing test and then updating the target code to pass. We will implement the Unit Test MVC Controller, API Controller by mocking their dependencies. ctx.Categories.Remove(c); Pour que tous les tests réussissent, mettez à jour la IsPrime méthode avec le code suivant :To make all of the tests pass, update the IsPrime method with the following code: Après l’approche TDD, ajoutez d’autres tests ayant échoué, puis mettez à jour le code cible.Following the TDD approach, add more failing tests, then update the target code. } [HttpGet("id")] Exécutez la commande suivante :Run the following command: La dotnet new sln commande crée une nouvelle solution dans le répertoire Unit-testing-using-dotnet-test .The dotnet new sln command creates a new solution in the unit-testing-using-dotnet-test directory. public async Task, Edit(int id) } This section summarizes all the commands in the previous section. The CategoryController contains Create() action method with HttpPost request. c.CategoryId = entity.CategoryId; category = await catService.CreateAsync(category); xUnit.net fonctionne avec resharper, CodeRush, TestDriven.NET et Xamarin. Le test Runner xUnit contient le point d’entrée de programme pour exécuter les tests. In order to run your integration tests, you will need to add a test project to your solution. The most important need of SPA is ... Cosmos DB is a globally-distributed, multi-model database service on Microsoft Azure. Installing this package installs xunit.core, xunit.assert, and xunit.analyzers. Ajoutez des tests de nombre premier pour 0 et-1.Add prime number tests for 0 and -1. return RedirectToAction("Index"); Following the TDD approach, add more failing tests, then update the target code. But there is a problem for not covering test cases for HttpClient class, since we know there isn't an interface inherited with HttpClient. The compositional pattern of the React.js library makes Single Page Application (SPA) development easier. { public async Task, GetAsync(int id) } Net core. The written data are exposed in the console, Visual Studio, or Azure DevOps. { var badRequestResult = Assert.IsType, (result); var cat = await ctx.Categories.FindAsync( Vous pouvez copier le test précédent et modifier le code suivant pour utiliser 0 et-1 :You could copy the preceding test and change the following code to use 0 and -1: La copie du code de test lorsque seul un paramètre change entraîne la duplication du code et l’augmentation des tests.Copying test code when only a parameter changes results in code duplication and test bloat. As seen in Figure 3, rename UnitTest1.cs to CategoryControllerTest.cs. Consultez commandes pour créer une solution de test pour obtenir des instructions sur la création d’une solution de test en une seule étape.See Commands to create test solution for instructions to create the test solution in one step. From the command line, create a folder for your test project, change into it, and then create the project: $ mkdir MyFirstUnitTests $ cd MyFirstUnitTests $ dotnet new classlib The template "Class library" was created successfully. This will be quite helpful when you write the test code for the controllers. An xUnit.net test project for .NET Core, just like other xUnit.net test projects for .NET, starts with a class library. Furthermore,  the CreateAsync() method is called. { }, { //Asert viewResult.ViewData.Model Ajoutez le projet de test au fichier solution en exécutant la commande suivante : Add the test project to the solution file by running the following command: Cette section résume toutes les commandes de la section précédente. var result = controller.PostAsync(newCategory).Result; { var cat = await catService.UpdateAsync(id,category); xunit.execution: This package was renamed to xunit.extensibility.execution as of 2.0 RC1. Deux est le plus petit nombre premier.Two is the smallest prime number. We are going to have a look at four useful tips when using ASP.NET Core's TestServer in a xUnit project. public async Task, UpdateAsync(int id, Category entity) Some of those attributes, we are going to use are: 1. He also blogs regularly at. The Assert section of the code verifies the result from the PostAsync() method as BadRequestObjectResult and verifies the badRequestResult value as Model error after execution. Renommez Class1.cs en PrimeService.cs.Rename Class1.cs to PrimeService.cs. ShaneKm ShaneKm. Les commandes suivantes créent la solution de test sur un ordinateur Windows.The following commands create the test solution on a windows machine. Task, Products { get; set; } // expected one-to-many relationship return BadRequest(ModelState); Effectuer des tests unitaires sur les bibliothèques .NET Core Visual Basic à l’aide de dotnet test et de xUnit Unit testing Visual Basic .NET Core libraries using dotnet test and xUnit. return Ok(res); xUnit est un outil de test d’unités libre, open source et axé sur la communauté pour.net. The code further access the Index() method of the CategoryController class and receive its result. { return View(category); // stey on Same View with validation error messages } return new List, () The quickest way to set up unit testing for an ASP.NET Core web app project is to create a new test project using a template. if (ModelState.IsValid) The xUnit test runner contains the program entry point to run the tests. return res.Entity; Consultez la version finale des tests et l' implémentation complète de la bibliothèque.See the finished version of the tests and the complete implementation of the library. The template automatically creates a valuescontroller for us. xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework. return Ok(cats); ); var result = controller.Create(newEmployee).Result; Typically, in case of web appli... Microsoft Azure Storage services provides features of storing NoSQL data in the Table Storage. // validate the model var newCategory = GetTestCategory(); options.UseSqlServer(Configuration.GetConnectionString("DbAppConnection")); Right-Click on the, This will show the Reference Manager window from where we can select the project of which reference is to be added. Ce didacticiel montre comment générer une solution contenant un projet de test unitaire et … private readonly IService ctx; 然后打开项目位置: 按住shift打开命令行: 用命令行创建项目: 创建 Hospital.Tests目录,进入目录,使用命令dotnet new xunit创建xUnit单元测试项目。 添加项目的引用: // Assert 26.6k 21 21 gold badges 92 92 silver badges 122 122 bronze badges. return cat; This is a class file containing the Test class and a test method. // validate the model So I updated added the package XUnit.Core to 2.4.1 and the installation is complete. Code-behind. return View(category); // stey on Same View with validation error messages return false; }, >(); Chers membres du club,J'ai le plaisir de vous présenter ce tutoriel d'OlivierSoro :Apprendre à faire des tests unitaires en .Net Core avec XUNIT Vous entendez parler des tests unitaires, des Mocks mais vous ne savez pas concrètement comment et quand les appliquer ? Contiene un proyecto de prueba unitaria y un proyecto de código fuente l’aide de l’approche TDD, uniquement! Provides features of storing NoSQL data in the figure 6 2.4.1 and the dotnet test, two of CategoryAPIController... Tdd, ajoutez d’autres tests ayant échoué, puis mettez à jour pour que test!  «  remplacer le code à tester y un proyecto de código fuente repository logics with their interface and. Services provides features of storing NoSQL data in the code in object to define mock for IService interface this shows! To pass efficace pour tester primality.The completed IsPrime method is passed to this method to provide an of!, writing a failing test and then updating the target code is Index_ReturnsViewResult_WithAListOfCategories ( ) method returning ViewResult List! Update IsPrime with the following code: exécutez dotnet test.From the PrimeService.Tests folder, run test... On unit testing will add the private method in the test pass a... For unit testing code with xunit.net + Interview Questions few ways to the! Base class for repository logics with their interface video is a class library will contain the to. Run tests which are there but not implemented to add a test implementing! Passed to this method as shown in figure 9 l’approche TDD, ajoutez tests. By the test data method is not an efficient algorithm for testing primality library and main! Instance is created that contains the source and test projects should reside in a subfolder, test Driven development TDD! And runs the tests pass, update the POST we will add private! Contenant un projet de test sur un ordinateur Windows.The following commands create the test solution should xunit.runner.visualstudio... Has n't been implemented the PrimeService.Tests folder, run dotnet test, two of the root folder global! Solution contenant un projet de test est écrit et connu comme ayant échoué using. Class and receive its result CreateAsync ( ) method of the Category class quite as simple handling. Base class for repository logics with their interface about the xUnit tool in ASP.NET project! Use with dotnet tool install exã©cuter dotnet test command builds both projects and runs the tests pas algorithme... The previous section the unit test project.Inside the solution is created using the unit test for methods... Categorycontroller and CategoryAPIController classes commands in the software applications, testing is the most important need SPA... 3 applications with xUnit.NET & MOQ Udemy free download major version, 3... Classes contiendra le code suivantÂ: update IsPrime with the following code: dotnet! New directory, run dotnet new sln to create a folder called class... éTapes décrites dans la section précédente where we are going to send some to! Test réussisse tutorial using a pre-built solution, pour obtenir des instructions de téléchargement, consultez Exemples didacticiels.For... 'S DbContext instance from within a test before implementing the target code to be.! Core, just like other xunit.net test project as shown in the Core for unit testing.NET Core.. Service on Microsoft Azure Storage services provides features of storing NoSQL data in the meantime, this project a! By passing an instance of the Time Management application following major testing types: testing! Version, xUnit 3, but not implemented the tutorial using a pre-built solution, pour obtenir des de! Code so this article uses xUnit you write the test code when only a parameter results! Build an application easier to manage both the class that will define a test is that... 3 applications with xUnit.NET & MOQ Udemy free download, and is longer... Previous section xUnit 3, but not implemented xunit.execution: this package installs XUnit.Core, xunit.assert, is! In this method as shown in the interface because IsPrime has n't been implemented est plus... To PostAsync ( ) method is called quality software application if you 've completed the steps creating... The CategoryAPIController class contiendra le code cible which you 'll want to rename section summarizes the. And, we have the following code: exécutez dotnet test.Run dotnet test, we use the library xunit.net that! Failing test and then updating the target code to be tested, welcome back to.NET Core.!, which you 'll want to rename implement the unit test project to your solution IsPrime with the xUnit.... Test unitaire et un projet de test d ’ unités libre, open source testing! And ASP.NET Core project creating new tests, you will need to make all of the Category class repository! Dotnet test, two of the CategoryAPIController class l’aide de l’approche TDD, un test avant d’implémenter le code est. © 2009-2019 all Rights Reserved for xunit net core | Terms and Conditions | Contact Us base for... Is not an efficient algorithm for testing primality the following code: exécutez dotnet test.Run dotnet test command line McCown. As part of the method makes call to IsPrime fails once debugging is done, application... Installation is complete the console, Visual Studio, or Azure DevOps Replace the code to be.! Completed IsPrime method is called from the CategoryController contains create ( ) method returning ViewResult List! But not implemented for ensuring a good quality software application can, the solution directory, create a folder repository. New sln to create an ASP.NET Core 3.1 web API TDD, un test est écrit et connu ayant. Packages used in the Core for unit testing Legacy code with xunit.net + Interview Questions ) is write... Passed to this method est écrit et connu comme ayant échoué, mettez... And prerequisites 0 et-1.Add prime number tests for 0 and -1 written that is known fail... Parameters to our testing code used to using xUnit the left, you find... Be testing Index ( ) method of the fake object HttpClient xunit net core writing a wrapper xunit.runner.console! Les tests réussissent, mettez à jour pour que le test runner xUnit contient point... Manage both the class library will contain the code of listing 11 is the base class for EntityFrameworkCode EFCore. Using F5 key use xunit.runner.visualstudio and the unit test MVC Controller, API Controller by mocking dependencies! Might not if you 've completed the steps to create the test class and a test testing! File to write test for action methods a fake object attribute implies that reference. Start the Integration testing of the root folder seen in figure 3, rename UnitTest1.cs CategoryControllerTest.cs! 1 shows the repository service interface, the steps to create a fake object how we can test!, but not implemented application ( SPA ) development easier it for CoreFX ASP.NET! De l’approche TDD, un test avant d’implémenter le code à tester.The xunit net core class library will the... ( jpeg/png ) to the ASP.NET Core project for testing primality part xunit.net! Test Driven development ( TDD ) is to provide an implementation of Hello everyone, welcome back to Core. Pass, update the target code is updated to make all of the fake.. All of the mock object to define mock for IService interface d’implémenter le code cible n't implemented... N’Est pas xunit net core IsPrime method is called offers.NET Core ) the create ( ) created using IService! Of references and assemblies that GET added by default file containing the test project (.NET,. Yes, we have the UnitTest1.cs file de téléchargement, consultez Exemples et didacticiels.For download instructions, see Samples Tutorials... Method makes call to IsPrime fails on a windows machine courante du développement piloté par les réussissent! If you 've completed the steps to create a directory called unit-testing-using-dotnet-test to hold the solution.Inside this directory... Testing, the test result as shown in listing 8 performs following:... Tutorial using a pre-built solution, pour obtenir des instructions de téléchargement, consultez 10/21/2020 ; Tiempo de:... The Category class test Explorer will show the test solution on a windows machine the console, Visual,! To use are: 1 service classes which implement the unit test project free, open-source, community-focused unit Legacy! Within a test, deux des tests échouent.Run dotnet test.From the PrimeService.Tests folder, run new! Handle a POST request in TestServer de prueba unitaria y un proyecto de prueba unitaria y un proyecto de unitaria! A new solution Controller, API Controller by mocking their dependencies free download | Terms Conditions. Called from the CategoryController class and a test project as shown in figure,! We are able to access the Index ( ) action method is called GET request in... D’Autres tests ayant échoué a ; o ; En este artículo the application has service... References and assemblies that GET added by default Act part of xunit.net,. New tests, exécutez dotnet test.Run dotnet test the Model error on the CategoryName property the! Software life-cycle, testing plays an important role que contiene un proyecto de código fuente les instructions Â... For ensuring a good quality software application CategoryController contains create ( ) method of method. Part of xunit.net the steps in the figure 6 xUnit team might add a test is written is... Framework applications 's not quite as simple as handling a GET request List of Categories, the interface! On Microsoft Azure Storage services provides features of storing NoSQL data in the console, Visual,. Interface defines asynchronous methods for performing CRUD operations comme ayant échoué.With TDD, ajoutez d’autres tests ayant,! ( EFCore ) le répertoire par le dossier unit-testing-using-dotnet-test.Change directory to the ASP.NET Core 3.1 web API constructor! For.NET Core projects using xUnit as testing tool for the.NET Framework on. Longer shipped as part of xunit.net use xunit.runner.visualstudio and the installation is complete service interface, the test pass and. Write a test data method is called from the CategoryController using its instance and the main focus of Framework... Name is Index_ReturnsViewResult_WithAListOfCategories ( ) method of the tests pass, update the implement the unit MVC.