public async Task Then_Gets_Frameworks_From_Courses_Api(
            GetFrameworksQuery query,
            GetFrameworksListResponse apiResponse,
            [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > mockApiClient,
            GetFrameworksQueryHandler handler)
        {
            mockApiClient
            .Setup(client => client.Get <GetFrameworksListResponse>(It.IsAny <GetFrameworksRequest>()))
            .ReturnsAsync(apiResponse);

            var result = await handler.Handle(query, CancellationToken.None);

            result.Frameworks.Should().BeEquivalentTo(apiResponse.Frameworks);
        }
Пример #2
0
        public async Task Then_Gets_Frameworks_From_Service(
            GetFrameworksQuery query,
            List <Framework> frameworkFromService,
            [Frozen] Mock <IFrameworksService> mockFrameworksService,
            GetFrameworksQueryHandler handler)
        {
            mockFrameworksService
            .Setup(service => service.GetFrameworks())
            .ReturnsAsync(frameworkFromService);

            var result = await handler.Handle(query, CancellationToken.None);

            result.Frameworks.Should().BeEquivalentTo(frameworkFromService);
        }