public async Task GetAllProceedingDecisions_Valid() { // Arrange IEnumerable <ProceedingDecisionModel> expected = GetSampleData(); _mockProceedingDecisionsService.RetrieveAllAsync().Returns(expected); // Act ActionResult <IEnumerable <ProceedingDecisionModel> > response = await _sut.GetAllProceedingDecisions(); // Assert await _mockProceedingDecisionsService.Received(1).RetrieveAllAsync(); var createdAtActionResult = Assert.IsType <OkObjectResult>(response.Result); IEnumerable <ProceedingDecisionModel> actual = (IEnumerable <ProceedingDecisionModel>)createdAtActionResult.Value; Assert.True(actual is not null); Assert.Equal(expected.Count(), actual.Count()); for (int i = 0; i < expected.Count(); i++) { Assert.Equal(expected.ElementAt(i).ProceedingDecisionId, actual.ElementAt(i).ProceedingDecisionId); Assert.Equal(expected.ElementAt(i).ProceedingDecisionName, actual.ElementAt(i).ProceedingDecisionName); Assert.Equal(expected.ElementAt(i).HasNextHearingDate, actual.ElementAt(i).HasNextHearingDate); Assert.Equal(expected.ElementAt(i).HasOrderAttachment, actual.ElementAt(i).HasOrderAttachment); } }
public async Task <ActionResult <IEnumerable <ProceedingDecisionModel> > > GetAllProceedingDecisions() { IEnumerable <ProceedingDecisionModel> proceedingDecisions = await _proceedingDecisionsService.RetrieveAllAsync(); return(Ok(proceedingDecisions)); }