Added unit tests

This commit is contained in:
thermalthrottle
2021-03-20 11:04:58 +02:00
parent bb4f2b4f16
commit bec08c5851
7 changed files with 118 additions and 19 deletions

View File

@@ -44,7 +44,7 @@ namespace Business.Business.Sales
/// Gets All Roles
/// </summary>
/// <remarks>
/// Requires no special roles
/// Requires no special roles.
/// </remarks>
/// <returns>
/// Returns a ICollection of all roles.
@@ -56,12 +56,13 @@ namespace Business.Business.Sales
}
/// <summary>
/// Searches the role by given Id
/// Searches the role by given Id.
/// </summary>
/// <remarks>
/// Requires no special roles.
/// </remarks>
/// <returns>
/// Returns an object of the role with the given Id.
///
/// Requires no special roles
/// </returns>
public Product Get(int id)
@@ -80,10 +81,11 @@ namespace Business.Business.Sales
/// <summary>
/// Searches the role by given name
/// </summary>
/// <remarks>
/// Requires no special roles.
/// </remarks>
/// <returns>
/// Returns an object of the role with the given name.
///
/// Requires no special roles
/// </returns>
public Product Get(string name)
@@ -102,10 +104,11 @@ namespace Business.Business.Sales
/// <summary>
/// Searches the role by a given substring
/// </summary>
/// <remarks>
/// Requires no special roles.
/// </remarks>
/// <returns>
/// Returns an ICollection of all roles that contain the given substring in their name.
///
/// Requires no special roles
/// </returns>
public ICollection<Product> GetByApproximateName(string name)

View File

@@ -51,14 +51,17 @@ namespace Business.Business.UserManagment.Controllers
this.context = context;
this.currentUser = currentUser;
}
/// <summary>
/// Creates the roles
/// </summary>
/// <remarks>
/// Requires no special roles. Not even an registered user.
/// </remarks>
/// <remarks>
/// Almost every method of each class checks if the user has suffficient roles for the task
/// </remarks>
public void CreateInitialRoles()
{
var Cashier = new Role("Cashier");

View File

@@ -161,10 +161,13 @@ namespace Business.Business.UserManagment
/// Checks if the password is valid
/// </summary>
/// <remarks>
/// Password is used to log in the user
/// Requires no special roles.
/// </remarks>
/// <remarks>
/// Password is used to log in the user.
/// </remarks>
/// <returns>
/// Returns an object of the found user
/// Returns an object of the found user.
/// </returns>
public User ValidatePassword(string password)
@@ -181,7 +184,10 @@ namespace Business.Business.UserManagment
/// Registers an user
/// </summary>
/// <remarks>
/// Used for the creation of the initial user, so it assigns admin role by default
/// Requires no special roles.
/// </remarks>
/// <remarks>
/// Used for the creation of the initial user, so it assigns admin role by default.
/// </remarks>
public void RegisterItem(string name, string password)