Skip to content

Commit

Permalink
dbtessting file
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloDiazSSA committed Nov 24, 2023
1 parent d3707af commit 66323d1
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -399,5 +399,4 @@ FodyWeavers.xsd

#SettingsFiles
/appsettings.Production.json
#DAtaTests
Data/DbUsersTest/DbUsers.cs
#DAtaTests
78 changes: 78 additions & 0 deletions Data/DbUsersTest/DbUsers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using Entregable2_PD.Models.DBO.Models;

namespace Entregable2_PD.Data.DbUsersTest
{
/// <summary>
///
/// </summary>
public static class DbUsers
{
/// <summary>
/// retorna dbusers
/// </summary>
/// <returns></returns>
public static List<UserModel> ReturnUsersForTesting(IConfiguration _config)
{
try
{
UserModel userIntA = new()
{
Name = _config.GetSection("CRED:EmailIntA").Value.Split('@')[0],
Email = _config.GetSection("CRED:EmailIntA").Value,
Password = _config.GetSection("CRED:PwdIntA").Value,
Salt = _config.GetSection("CRED:SaltIntA").Value,
Type = (_config.GetSection("CRED:EmailIntA").Value.Contains("interno") ? "AUTHORIZED" : "UNAUTHORIZED"),
Role = (_config.GetSection("CRED:EmailIntA").Value.Contains("administrador") ? "ADMIN" : "USER"),
RegDate = DateTime.Now,
};

UserModel userIntU = new()
{
Name = _config.GetSection("CRED:EmailIntU").Value.Split('@')[0],
Email = _config.GetSection("CRED:EmailIntU").Value,
Password = _config.GetSection("CRED:PwdIntU").Value,
Salt = _config.GetSection("CRED:SaltIntU").Value,
Type = (_config.GetSection("CRED:EmailIntU").Value.Contains("interno") ? "AUTHORIZED" : "UNAUTHORIZED"),
Role = (_config.GetSection("CRED:EmailIntU").Value.Contains("administrador") ? "ADMIN" : "USER"),
RegDate = DateTime.Now,
};

UserModel userExtA = new()
{
Name = _config.GetSection("CRED:EmailExtA").Value.Split('@')[0],
Email = _config.GetSection("CRED:EmailExtA").Value,
Password = _config.GetSection("CRED:PwdExtA").Value,
Salt = _config.GetSection("CRED:SaltExtA").Value,
Type = "AUTHORIZED",
Role = (_config.GetSection("CRED:EmailExtA").Value.Contains("administrador") ? "ADMIN" : "USER"),
RegDate = DateTime.Now,
};

UserModel userExtU = new()
{
Name = _config.GetSection("CRED:EmailExtU").Value.Split('@')[0],
Email = _config.GetSection("CRED:EmailExtU").Value,
Password = _config.GetSection("CRED:PwdExtU").Value,
Salt = _config.GetSection("CRED:SaltExtU").Value,
Type = "UNAUTHORIZED",
Role = (_config.GetSection("CRED:EmailExtU").Value.Contains("administrador") ? "ADMIN" : "USER"),
RegDate = DateTime.Now,
};
return new List<UserModel>
{
userIntA,
userIntU,
userExtA,
userExtU
};
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw;
}


}
}
}

0 comments on commit 66323d1

Please sign in to comment.