573 lines
18 KiB
C#
573 lines
18 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Moq;
|
|
using NUnit.Framework;
|
|
using LCU.Library.Internal.Exceptions;
|
|
using LCU.API.Internal.DocumentIngestor.Controllers;
|
|
using LCU.API.Internal.DocumentIngestor.Services;
|
|
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
|
using System.Collections.Generic;
|
|
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
|
using LCU.Library.Internal.DocumentIngestorModels.Enums;
|
|
using System.Linq;
|
|
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace LCU.API.Internal.DocumentIngestorTests.Controllers;
|
|
|
|
public class DocumentProcessingInfoControllerTest
|
|
{
|
|
private DocumentProcessingInfoController _documentProcessingInfoController;
|
|
private Mock<IDocumentProcessingInfoService> _mockDocumentProcessingInfoService;
|
|
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
_mockDocumentProcessingInfoService = new Mock<IDocumentProcessingInfoService>();
|
|
_documentProcessingInfoController = new DocumentProcessingInfoController(_mockDocumentProcessingInfoService.Object);
|
|
}
|
|
|
|
[Test]
|
|
public async Task Get_OK()
|
|
{
|
|
var documentProcessingInfos = new List<DocumentProcessingInfo>()
|
|
{
|
|
new DocumentProcessingInfo()
|
|
{
|
|
DocumentProcessingInfoId = 1
|
|
}
|
|
};
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetAsync())
|
|
.ReturnsAsync(documentProcessingInfos).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Get();
|
|
Assert.NotNull(result);
|
|
|
|
var okResult = result as OkObjectResult;
|
|
Assert.NotNull(okResult);
|
|
Assert.AreEqual(200, okResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Get_ServiceException_InternalServerError()
|
|
{
|
|
var documentProcessingInfos = new List<DocumentProcessingInfo>();
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetAsync())
|
|
.ThrowsAsync(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Get();
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Get_UnexpectedException_InternalServerError()
|
|
{
|
|
var documentProcessingInfos = new List<DocumentProcessingInfo>();
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetAsync())
|
|
.ThrowsAsync(new Exception("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Get();
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as StatusCodeResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetById_OK()
|
|
{
|
|
var id = 1;
|
|
var documentProcessingInfo = new DocumentProcessingInfo();
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetByIdAsync(id))
|
|
.ReturnsAsync(documentProcessingInfo).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.GetById(id);
|
|
Assert.NotNull(result);
|
|
|
|
var okResult = result as OkObjectResult;
|
|
Assert.NotNull(okResult);
|
|
Assert.AreEqual(200, okResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetById_ServiceException_InternalServerError()
|
|
{
|
|
var id = 1;
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetByIdAsync(id))
|
|
.ThrowsAsync(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.GetById(id);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetById_UnexpectedException_InternalServerError()
|
|
{
|
|
var id = 1;
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetByIdAsync(id))
|
|
.ThrowsAsync(new Exception("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.GetById(id);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as StatusCodeResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetByIngestorRunInfoId_OK()
|
|
{
|
|
var ingestorRunInfoId = Guid.NewGuid();
|
|
var documentProcessingInfos = new List<DocumentProcessingInfo>()
|
|
{
|
|
new DocumentProcessingInfo()
|
|
{
|
|
DocumentProcessingInfoId = 1
|
|
}
|
|
};
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetByIngestorRunInfoIdAsync(ingestorRunInfoId))
|
|
.ReturnsAsync(documentProcessingInfos).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.GetByIngestorRunInfoId(ingestorRunInfoId);
|
|
Assert.NotNull(result);
|
|
|
|
var okResult = result as OkObjectResult;
|
|
Assert.NotNull(okResult);
|
|
Assert.AreEqual(200, okResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetByIngestorRunInfoId_ServiceException_InternalServerError()
|
|
{
|
|
var ingestorRunInfoId = Guid.NewGuid();
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetByIngestorRunInfoIdAsync(ingestorRunInfoId))
|
|
.ThrowsAsync(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.GetByIngestorRunInfoId(ingestorRunInfoId);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetByIngestorRunInfoId_UnexpectedException_InternalServerError()
|
|
{
|
|
var ingestorRunInfoId = Guid.NewGuid();
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetByIngestorRunInfoIdAsync(ingestorRunInfoId))
|
|
.ThrowsAsync(new Exception("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.GetByIngestorRunInfoId(ingestorRunInfoId);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as StatusCodeResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Post_CreatedAtAction()
|
|
{
|
|
var ingestorRunInfoId = Guid.NewGuid();
|
|
var request = new DocumentProcessingInfo()
|
|
{
|
|
IngestorRunInfoId = ingestorRunInfoId,
|
|
DocumentValuePayload = "Test"
|
|
};
|
|
|
|
var requestReturn = new DocumentProcessingInfo()
|
|
{
|
|
DocumentProcessingInfoId = 1,
|
|
DocumentValuePayload = "Test",
|
|
IngestorRunInfoId = Guid.NewGuid()
|
|
};
|
|
_mockDocumentProcessingInfoService.Setup(service => service.SaveAsync(request)).ReturnsAsync(requestReturn).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Post(request);
|
|
Assert.NotNull(result);
|
|
|
|
var okResult = result as CreatedAtActionResult;
|
|
Assert.NotNull(okResult);
|
|
Assert.AreEqual(201, okResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Post_ServiceException_InternalServerError()
|
|
{
|
|
var request = new DocumentProcessingInfo();
|
|
_mockDocumentProcessingInfoService.Setup(service =>
|
|
service.SaveAsync(request))
|
|
.ThrowsAsync(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Post(request);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Post_UnexpectedException_InternalServerError()
|
|
{
|
|
var request = new DocumentProcessingInfo();
|
|
_mockDocumentProcessingInfoService.Setup(service =>
|
|
service.SaveAsync(request))
|
|
.ThrowsAsync(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Post(request);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Put_OK()
|
|
{
|
|
var request = new DocumentProcessingInfo();
|
|
_mockDocumentProcessingInfoService.Setup(service => service.Update(request)).ReturnsAsync(request).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Put(request);
|
|
Assert.NotNull(result);
|
|
|
|
var okResult = result as OkObjectResult;
|
|
Assert.NotNull(okResult);
|
|
Assert.AreEqual(200, okResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Put_ServiceException_InternalServerError()
|
|
{
|
|
var request = new DocumentProcessingInfo();
|
|
_mockDocumentProcessingInfoService.Setup(service =>
|
|
service.Update(request))
|
|
.Throws(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Put(request);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Put_UnexpectedException_InternalServerError()
|
|
{
|
|
var request = new DocumentProcessingInfo();
|
|
_mockDocumentProcessingInfoService.Setup(service =>
|
|
service.Update(request))
|
|
.Throws(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Put(request);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Delete_OK()
|
|
{
|
|
var id = 1;
|
|
_mockDocumentProcessingInfoService.Setup(service => service.Delete(id)).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Delete(id);
|
|
Assert.NotNull(result);
|
|
|
|
var okResult = result as OkResult;
|
|
Assert.NotNull(okResult);
|
|
Assert.AreEqual(200, okResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Delete_ServiceException_InternalServerError()
|
|
{
|
|
var id = 1;
|
|
_mockDocumentProcessingInfoService.Setup(service =>
|
|
service.Delete(id))
|
|
.Throws(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Delete(id);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task Delete_UnexpectedException_InternalServerError()
|
|
{
|
|
var id = 1;
|
|
_mockDocumentProcessingInfoService.Setup(service =>
|
|
service.Delete(id))
|
|
.Throws(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.Delete(id);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task PagedFilter_Ok()
|
|
{
|
|
|
|
// Arrange
|
|
var filter = new Filter()
|
|
{
|
|
Limit = 2,
|
|
Page = 1
|
|
};
|
|
|
|
_mockDocumentProcessingInfoService.Setup(service => service.GetFilteredDocumentProcessingInfo(filter))
|
|
.ReturnsAsync(new PagedResult<DocumentProcessingInfo>()
|
|
{
|
|
Total = 4,
|
|
Items = new List<DocumentProcessingInfo>()
|
|
{
|
|
new DocumentProcessingInfo() {DocumentProcessingInfoId = 1},
|
|
new DocumentProcessingInfo() {DocumentProcessingInfoId = 2},
|
|
new DocumentProcessingInfo() {DocumentProcessingInfoId = 3},
|
|
new DocumentProcessingInfo() {DocumentProcessingInfoId = 4}
|
|
}
|
|
});
|
|
|
|
// Act
|
|
var result = await _documentProcessingInfoController.GetFilteredDocumentProcessingInfo(filter);
|
|
|
|
// Assert
|
|
Assert.NotNull(result);
|
|
|
|
var okObject = result as OkObjectResult;
|
|
Assert.NotNull(okObject);
|
|
|
|
var pagedResponse = okObject.Value as PagedResponse<DocumentProcessingInfo>;
|
|
Assert.NotNull(pagedResponse);
|
|
|
|
Assert.AreEqual(4, pagedResponse.TotalItems);
|
|
|
|
Assert.AreEqual(1, pagedResponse.Items.ElementAt(0).DocumentProcessingInfoId);
|
|
Assert.AreEqual(2, pagedResponse.Items.ElementAt(1).DocumentProcessingInfoId);
|
|
|
|
Assert.AreEqual(0, pagedResponse.PreviousPage);
|
|
Assert.AreEqual(2, pagedResponse.NextPage);
|
|
Assert.AreEqual(2, pagedResponse.TotalPages);
|
|
}
|
|
|
|
[Test]
|
|
public async Task SetDocumentsToEntityUnknown_OK()
|
|
{
|
|
var request = new EntityUnknownRequest()
|
|
{
|
|
UserName = "System",
|
|
DocumentProcessingInfoIds = new List<int>() { 1, 2, 3 }
|
|
};
|
|
var documentProcessingInfos = new List<DocumentProcessingInfo>()
|
|
{
|
|
new()
|
|
{
|
|
DocumentProcessingInfoId = 1,
|
|
},
|
|
new()
|
|
{
|
|
DocumentProcessingInfoId = 2,
|
|
},
|
|
new()
|
|
{
|
|
DocumentProcessingInfoId = 3,
|
|
}
|
|
};
|
|
_mockDocumentProcessingInfoService.Setup(service => service.SetDocumentsToEntityUnknown(request)).ReturnsAsync(documentProcessingInfos).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.SetDocumentsToEntityUnknown(request);
|
|
Assert.NotNull(result);
|
|
|
|
var okResult = result as OkObjectResult;
|
|
Assert.NotNull(okResult);
|
|
Assert.AreEqual(200, okResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task SetDocumentsToEntityUnknown_ServiceException_InternalServerError()
|
|
{
|
|
var request = new EntityUnknownRequest()
|
|
{
|
|
UserName = "System",
|
|
DocumentProcessingInfoIds = new List<int>() { 1, 2, 3 }
|
|
};
|
|
_mockDocumentProcessingInfoService.Setup(service =>
|
|
service.SetDocumentsToEntityUnknown(request))
|
|
.Throws(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.SetDocumentsToEntityUnknown(request);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task UpdateStatus_OK()
|
|
{
|
|
var documentProcessingInfoId = DateTime.Now.Millisecond;
|
|
var request = new DocumentProcessingInfoStatusRequest()
|
|
{
|
|
DocumentProcessingInfoId = documentProcessingInfoId,
|
|
ProcessStatus = ProcessStatusTypes.Reprocessing,
|
|
ReasonMessage = Guid.NewGuid().ToString(),
|
|
Username = Guid.NewGuid().ToString()
|
|
};
|
|
var documentProcessingInfo = new DocumentProcessingInfo()
|
|
{
|
|
DocumentProcessingInfoId = DateTime.Now.Millisecond,
|
|
StatusType = ProcessStatusTypes.CriticalFailure
|
|
};
|
|
_mockDocumentProcessingInfoService.Setup(service => service.UpdateDocumentProcessingInfoStatus(request)).ReturnsAsync(documentProcessingInfo).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.UpdateDocumentProcessingInfoStatus(request);
|
|
Assert.NotNull(result);
|
|
|
|
var okResult = result as OkObjectResult;
|
|
Assert.NotNull(okResult);
|
|
Assert.AreEqual(200, okResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task UpdateStatus_ServiceException_InternalServerError()
|
|
{
|
|
var documentProcessingInfoId = DateTime.Now.Millisecond;
|
|
var request = new DocumentProcessingInfoStatusRequest()
|
|
{
|
|
DocumentProcessingInfoId = documentProcessingInfoId,
|
|
ProcessStatus = ProcessStatusTypes.Reprocessing,
|
|
ReasonMessage = Guid.NewGuid().ToString(),
|
|
Username = Guid.NewGuid().ToString()
|
|
};
|
|
_mockDocumentProcessingInfoService.Setup(service =>
|
|
service.UpdateDocumentProcessingInfoStatus(request))
|
|
.Throws(new ServiceException("Thrown From Unit Test")).Verifiable();
|
|
|
|
var result = await _documentProcessingInfoController.UpdateDocumentProcessingInfoStatus(request);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as ObjectResult;
|
|
Assert.NotNull(statusResult);
|
|
Assert.AreEqual(500, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task UpdateStatus_NoContent()
|
|
{
|
|
var documentProcessingInfoId = DateTime.Now.Millisecond;
|
|
var request = new DocumentProcessingInfoStatusRequest()
|
|
{
|
|
DocumentProcessingInfoId = documentProcessingInfoId,
|
|
ProcessStatus = ProcessStatusTypes.Reprocessing,
|
|
ReasonMessage = Guid.NewGuid().ToString()
|
|
};
|
|
DocumentProcessingInfo? documentProcessingInfo = null;
|
|
_mockDocumentProcessingInfoService.Setup(service =>
|
|
service.UpdateDocumentProcessingInfoStatus(request))
|
|
.ReturnsAsync(documentProcessingInfo);
|
|
|
|
var result = await _documentProcessingInfoController.UpdateDocumentProcessingInfoStatus(request);
|
|
Assert.NotNull(result);
|
|
|
|
var statusResult = result as NoContentResult;
|
|
Assert.IsNotNull(statusResult);
|
|
Assert.AreEqual(204, statusResult!.StatusCode);
|
|
_mockDocumentProcessingInfoService.Verify();
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetByDocumentIds_InfoServiceReturnsResults_Returns200OkResults()
|
|
{
|
|
var ids = Enumerable.Repeat(Guid.NewGuid, 5)
|
|
.Select(f => f())
|
|
.ToArray();
|
|
var infos = new Dictionary<Guid, DocumentProcessingInfo>();
|
|
_mockDocumentProcessingInfoService
|
|
.Setup(dpis => dpis.GetByDocumentIdsAsync(ids))
|
|
.ReturnsAsync(infos);
|
|
|
|
var result = await _documentProcessingInfoController.GetByDocumentIds(ids);
|
|
|
|
Assert.IsInstanceOf<OkObjectResult>(result);
|
|
Assert.AreEqual(StatusCodes.Status200OK, ((OkObjectResult)result).StatusCode);
|
|
Assert.AreEqual(infos, ((OkObjectResult)result).Value);
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetByDocumentIds_InfoServiceThrowsException_Returns500InternalServerError()
|
|
{
|
|
var ids = Enumerable.Repeat(Guid.NewGuid, 5)
|
|
.Select(f => f())
|
|
.ToArray();
|
|
_mockDocumentProcessingInfoService
|
|
.Setup(dpis => dpis.GetByDocumentIdsAsync(ids))
|
|
.ThrowsAsync(new Exception());
|
|
|
|
var result = await _documentProcessingInfoController.GetByDocumentIds(ids);
|
|
|
|
Assert.IsInstanceOf<StatusCodeResult>(result);
|
|
Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)result).StatusCode);
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetByDocumentIds_InfoServiceThrowsServiceException_Returns500InternalServerError()
|
|
{
|
|
var ids = Enumerable.Repeat(Guid.NewGuid, 5)
|
|
.Select(f => f())
|
|
.ToArray();
|
|
_mockDocumentProcessingInfoService
|
|
.Setup(dpis => dpis.GetByDocumentIdsAsync(ids))
|
|
.ThrowsAsync(new ServiceException(string.Empty));
|
|
|
|
var result = await _documentProcessingInfoController.GetByDocumentIds(ids);
|
|
|
|
Assert.IsInstanceOf<ObjectResult>(result);
|
|
Assert.AreEqual(StatusCodes.Status500InternalServerError, ((ObjectResult)result).StatusCode);
|
|
}
|
|
} |