DamageAssessment_Backend/DamageAssesmentApi/DamageAssesment.Api.UsersAccess.Test/MockData.cs

45 lines
1.7 KiB
C#
Raw Normal View History

using DamageAssesment.Api.UsersAccess.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit.Sdk;
namespace DamageAssesment.Api.UsersAccess.Test
{
public class MockData
{
public static async Task<(bool, Models.TokenResponse, string)> getTokenResponse(bool status, string message)
{
return (status, new Models.TokenResponse { jwttoken = "1234", refreshtoken = "12345" }, message);
}
public static async Task<(bool, List<User>, string)> getUsers(bool status, string message)
{
List<User> users = new List<User>();
users.Add(new User { Id = 1, EmployeeCode = "Emp1", EmployeeId = 1, RoleId = 1, IsActive = true, CreateDate = DateTime.Now });
users.Add(new User { Id = 2, EmployeeCode = "Emp2", EmployeeId = 2, RoleId = 1, IsActive = true, CreateDate = DateTime.Now });
users.Add(new User { Id = 3, EmployeeCode = "Emp3", EmployeeId = 3, RoleId = 1, IsActive = true, CreateDate = DateTime.Now });
return (status, users, message);
}
public static async Task<(bool, User, string)> getUser(bool status, string message)
{
User user = getUsers(status, message).Result.Item2.FirstOrDefault();
return (status, user, message);
}
public static async Task<(bool, List<Role>, string)> getRoles(bool status, string message)
{
List<Role> roles = new List<Role>();
roles.Add(new Role { Id = 1, Name = "Role 1" });
roles.Add(new Role { Id = 2, Name = "Role 2" });
roles.Add(new Role { Id = 3, Name = "Role 3" });
return (status, roles, message);
}
}
}