A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
The interface IApprovalDefinitionRepository has some basic methods I can mock against but if I want to unit test the _approvalDefinitionRepository.GetAsync(ContentReference), that I guess many will use, it's extremely more work to be done to mock.
Before reaching the interface and method IApprovalDefinitionRepository.GetItemsAsync(IEnumerable()) that is unit test friendly we go through several static classes/methods (at least one is even internal). It's not that easy to unit test.
Please make it more unit test friendly so that instead of looking at Uris in the IApprovalDefinitionRepository.GetItemsAsync(IEnumerable()) I can match against ContentReferences in _approvalDefinitionRepository.GetAsync(ContentReference).
Example
_approvalDefinitionRepository.Setup(x => x.GetItemsAsync(It.IsAny>())) inUris) =>
.ReturnsAsync((IEnumerable
{
if(inUris.ElementAt(0).ToString().EndsWith(myContentReference.Id.ToString()))
{
// Do stuff
}
else
{
// Do stuff
}
return new List { new ContentApprovalDefinition() };
});
would be more easy if I could just do
_approvalDefinitionRepository.Setup(x => x.GetAsync(myContentReference)).ReturnAsync(...);