refactor: Projektdateien migriert. Cloud-NuGet-Pakete durch lokale NuGet-Projekte ersetzt.
This commit is contained in:
730
XUnitDAL.Test/Test_Controller_Entity.cs
Normal file
730
XUnitDAL.Test/Test_Controller_Entity.cs
Normal file
@@ -0,0 +1,730 @@
|
||||
using DAL.Repositories;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using NLog.Filters;
|
||||
using StaffDBServer.Controllers;
|
||||
using Xunit;
|
||||
using XUnitWebApi.SharedConfig;
|
||||
|
||||
namespace XUnitWebApi.Controller
|
||||
{
|
||||
public class Test_Controller_Entity
|
||||
{
|
||||
//----Check_GetEntityController
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetSubsidiaryController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
SubsidiaryRepository repository = new SubsidiaryRepository();
|
||||
SubsidiaryController controller = new SubsidiaryController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.SubsidiaryId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWindreamInputFolderController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 49;
|
||||
WindreamInputFolderRepository repository = new WindreamInputFolderRepository();
|
||||
WindreamInputFolderController controller = new WindreamInputFolderController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WindreamInputFolderId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWindreamSearchToDepartmentController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
WindreamSearchToDepartmentRepository repository = new WindreamSearchToDepartmentRepository();
|
||||
WindreamSearchToDepartmentController controller = new WindreamSearchToDepartmentController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WindreamSearchToDepartmentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWindreamSearchItemToWindreamSearchToDepartmentController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
WindreamSearchItemToWindreamSearchToDepartmentRepository repository = new WindreamSearchItemToWindreamSearchToDepartmentRepository();
|
||||
WindreamSearchItemToWindreamSearchToDepartmentController controller = new WindreamSearchItemToWindreamSearchToDepartmentController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WindreamSearchItemToWindreamSearchToDepartmentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWindreamSearchItemController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
WindreamSearchItemRepository repository = new WindreamSearchItemRepository();
|
||||
WindreamSearchItemController controller = new WindreamSearchItemController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WindreamSearchItemId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWindreamSearchController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
WindreamSearchRepository repository = new WindreamSearchRepository();
|
||||
WindreamSearchController controller = new WindreamSearchController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WindreamSearchId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWindreamIndexToWindreamSearchToDepartmentController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
WindreamIndexToWindreamSearchToDepartmentRepository repository = new WindreamIndexToWindreamSearchToDepartmentRepository();
|
||||
WindreamIndexToWindreamSearchToDepartmentController controller = new WindreamIndexToWindreamSearchToDepartmentController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WindreamIndexToWindreamSearchToDepartmentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWindreamIndexController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
WindreamIndexRepository repository = new WindreamIndexRepository();
|
||||
WindreamIndexController controller = new WindreamIndexController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WindreamIndexId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWindreamColumnsToDepartmentController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
WindreamColumnsToDepartmentRepository repository = new WindreamColumnsToDepartmentRepository();
|
||||
WindreamColumnsToDepartmentController controller = new WindreamColumnsToDepartmentController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WindreamColumnsToDepartmentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWebAppToWebAppRoleController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 2;
|
||||
WebAppToWebAppRoleRepository repository = new WebAppToWebAppRoleRepository();
|
||||
WebAppToWebAppRoleController controller = new WebAppToWebAppRoleController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WebAppToWebAppRoleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWebAppToWebAppAdditionalRoleController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 70;
|
||||
WebAppToWebAppAdditionalRoleRepository repository = new WebAppToWebAppAdditionalRoleRepository();
|
||||
WebAppToWebAppAdditionalRoleController controller = new WebAppToWebAppAdditionalRoleController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WebAppToWebAppAdditionalRoleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWebAppToDepartmentController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 100;
|
||||
WebAppToDepartmentRepository repository = new WebAppToDepartmentRepository();
|
||||
WebAppToDepartmentController controller = new WebAppToDepartmentController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WebAppToDepartmentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWebAppAdditionalRoleController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
WebAppAdditionalRoleRepository repository = new WebAppAdditionalRoleRepository();
|
||||
WebAppAdditionalRoleController controller = new WebAppAdditionalRoleController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WebAppAdditionalRoleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetEmployeeToWebAppController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 300;
|
||||
EmployeeToWebAppRepository repository = new EmployeeToWebAppRepository();
|
||||
EmployeeToWebAppController controller = new EmployeeToWebAppController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.EmployeeToWebAppId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetEmployeeToDepartmentController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
EmployeeToDepartmentRepository repository = new EmployeeToDepartmentRepository();
|
||||
EmployeeToDepartmentController controller = new EmployeeToDepartmentController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.EmployeeToDepartmentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetEmployeeToAttributeController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 100;
|
||||
EmployeeToAttributeRepository repository = new EmployeeToAttributeRepository();
|
||||
EmployeeToAttributeController controller = new EmployeeToAttributeController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.EmployeeToAttributeId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetEmployeeController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
EmployeeRepository repository = new EmployeeRepository();
|
||||
EmployeeController controller = new EmployeeController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.EmployeeId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetDocumentArtToDepartmentController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
DocumentArtToDepartmentRepository repository = new DocumentArtToDepartmentRepository();
|
||||
DocumentArtToDepartmentController controller = new DocumentArtToDepartmentController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.DocumentArtToDepartmentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetDepartmentToWebAppToEmployeeForWindreamController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
DepartmentToWebAppToEmployeeForWindreamRepository repository = new DepartmentToWebAppToEmployeeForWindreamRepository();
|
||||
DepartmentToWebAppToEmployeeForWindreamController controller = new DepartmentToWebAppToEmployeeForWindreamController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.DepartmentToWebAppToEmployeeForWindreamId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWebAppRoleController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 10;
|
||||
WebAppRoleRepository repository = new WebAppRoleRepository();
|
||||
WebAppRoleController controller = new WebAppRoleController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WebAppRoleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetWebAppController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
WebAppRepository repository = new WebAppRepository();
|
||||
WebAppController controller = new WebAppController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.WebAppId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetRangController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
RangRepository repository = new RangRepository();
|
||||
RangController controller = new RangController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.RangId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetProjectController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
ProjectRepository repository = new ProjectRepository();
|
||||
ProjectController controller = new ProjectController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.ProjectId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetEmployeeStatusController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
EmployeeStatusRepository repository = new EmployeeStatusRepository();
|
||||
EmployeeStatusController controller = new EmployeeStatusController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.EmployeeStatusId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetEmployeeAttributeController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
EmployeeAttributeRepository repository = new EmployeeAttributeRepository();
|
||||
EmployeeAttributeController controller = new EmployeeAttributeController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.EmployeeAttributeId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetDocumentArtController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
DocumentArtRepository repository = new DocumentArtRepository();
|
||||
DocumentArtController controller = new DocumentArtController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.DocumentArtId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetDepartmentController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
DepartmentRepository repository = new DepartmentRepository();
|
||||
DepartmentController controller = new DepartmentController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.DepartmentId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetCostCentreController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 100;
|
||||
CostCentreRepository repository = new CostCentreRepository();
|
||||
CostCentreController controller = new CostCentreController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.CostCentreId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Check_Employee()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 272;
|
||||
var repo = new EmployeeRepository();
|
||||
var entity= await repo.GetByIdAsync(entityId);
|
||||
entity.PhoneNo = "1234";
|
||||
await repo.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Check_GetAdWebAppToWebAppRoleController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
AdWebAppToWebAppRoleRepository repository = new AdWebAppToWebAppRoleRepository();
|
||||
AdWebAppToWebAppRoleController controller = new AdWebAppToWebAppRoleController(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity.AdWebAppToWebAppRoleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user