Users management practice on .Net Core, using WebAPI and ASP.NET MVC Core
To develop and run ASP.NET Core applications locally, download and install the following:
- .NET Core SDK - includes the .NET Core runtime and command line tools
- Visual Studio Code - code editor that runs on Windows, Mac and Linux
- C# extension for Visual Studio Code - adds support to VS Code for developing .NET Core applications
- Download or clone the tutorial project code from https://github.com/fennnan/SHUsersManagement.git
- Open a shell command windows in the Project root folder
- Change folder to the Rest Api Server project root folder (where the RestServer.csproj file is located)
cd RestServer
- Start the api by running
dotnet runfrom the command line. You should see the messageNow listening on: http://localhost:5000. You can test the api directly using an application such as Postman or you can test it with one of the single page applications below.
- Open a shell command windows in the Project root folder
- Change folder to the Mvc UI application project root folder (where the MvcUI.csproj file is located)
cd MvcUI
- Start the api by running
dotnet runfrom the command line in the project root folder (where the WebApi.csproj file is located), you should see the messageNow listening on: http://localhost:6000 - You can test the app by opening writting http://localhost:6000 on the direction tool bar.
I have used XUnit for writting the Unit Test and Mock as a mocking framework. Because this project is intended as a proof of concept there is only Unit Test for the Rest API Server project.
- Open a shell command windows in the Project root folder
- Change folder to the Rest Api Server Unit Test project root folder (where the RestServer.Test.csproj file is located)
cd RestServer.Test
- Start the api by running
dotnet testfrom the command line. After few second it will show the results of the tests
- Have up and running both projects, Rest API Server and Mvc UI app
- Log in in the Mvc UI with one of these users:
- Admin/admin1 - Rol ADMIN
- User1/user1 - Rol PAGE_1
- User2/user2 - Rol PAGE_2
- User3/user3 - Rol PAGE_3
- Navigate through the differents pages
I didn't want to extend the project for a long time, so I decide to not implement some litle (or not so litle), details of the project.
- Add HTTPS support. The Basic Authentication is sended as a plain text and it shouldn't be in a not encripted web
- Add Unit Test for the Mvc UI app
- Add more tests for the Rest API Server