public async Task Then_The_Api_Is_Called_With_The_Request_And_Sectors_Returned_And_Added_To_Cache( GetSectorsQuery query, GetRoutesListResponse apiResponse, [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > apiClient, [Frozen] Mock <ICacheStorageService> cacheStorageService, GetSectorsQueryHandler handler ) { //Arrange cacheStorageService.Setup(x => x.RetrieveFromCache <GetRoutesListResponse>(nameof(GetRoutesListResponse))) .ReturnsAsync((GetRoutesListResponse) default);
public async Task Then_The_Service_Called_And_Data_Returned( GetSectorsQuery query, GetRoutesListResponse response, [Frozen] Mock <ICourseService> service, GetSectorsQueryHandler handler) { //Arrange service.Setup(x => x.GetRoutes()) .ReturnsAsync(response); //Act var actual = await handler.Handle(query, CancellationToken.None); //Assert actual.Sectors.Should().BeEquivalentTo(response.Routes); }