Last post Jan 26, 2021 07:20 PM by DA924
Jan 26, 2021 03:24 PM|Amani Al|LINK
I’m starting the testing phase for my web application and i’m confused where to start or what method is the best.
I fineshed develpoing a web application using asp.net core mvc which contains multiple of controllers, models, view models etc. and has functionalies such as, personal accounts, roles and prevlages, create, remove, lock accoonts crud functions on multiple
i’ve read about unit tests but couldn’t fully understand how it works on my project which is not a calculater or wheather degree converter :)
i would like to know how test if all functionalities is working as expected
any given opinions or articles with examples/demo is highly appreciated
Jan 26, 2021 07:20 PM|DA924|LINK
I think you can unit test if you are following SoC principles in developing the solution. If you have not followed SoC, then your solution will be hard to unit test.
Separation of concerns - Wikipedia
Understanding Separation Of Concern in ASP.NET MVC (c-sharpcorner.com)
Architectural principles | Microsoft Docs
Understanding Models, Views, and Controllers (C#) | Microsoft Docs
An MVC model contains all of your application logic that is not contained in a view or a controller. The model should contain all of your application business logic, validation logic, and database access logic. For example, if you are using the Microsoft
Entity Framework to access your database, then you would create your Entity Framework classes (your .edmx file) in the Models folder.
A view should contain only logic related to generating the user interface. A controller should only contain the bare minimum of logic required to return the right view or redirect the user to another action (flow control). Everything else should be contained
in the model.
In general, you should strive for fat models and skinny controllers. Your controller methods should contain only a few lines of code. If a controller action gets too fat, then you should consider moving the logic out to a new class in the Models folder.