Exemple #1
0
        public async Task FetchPublicRepository_GoodFlow(
            [GitlabDataSourceResourceResultDataSource]
            GitlabDataSourceResourceResult resourceResult)
        {
            // Arrange
            MockRestClient(resourceResult, HttpStatusCode.OK);
            DataSourceAdaptee = new GitlabDataSourceAdaptee(ConfigurationMock, ClientFactoryMock.Object, Mapper);

            // Act
            Uri    testUri = new Uri("https://google.nl/test");
            Action act     = () => DataSourceAdaptee.FetchPublicRepository(testUri);
            GitlabDataSourceResourceResult retrievedResourceResult =
                await DataSourceAdaptee.FetchPublicRepository(testUri);

            // Assert
            act.Should()
            .NotThrow();
            retrievedResourceResult.Should()
            .BeEquivalentTo(resourceResult);
        }
Exemple #2
0
        public void FetchPublicRepository_ResponseIsNotSuccessful()
        {
            // Arrange
            string errorMessage = "Invalid test request";

            MockRestClient(null, HttpStatusCode.BadRequest, errorMessage);
            DataSourceAdaptee = new GitlabDataSourceAdaptee(ConfigurationMock, ClientFactoryMock.Object, Mapper);

            // Act
            Uri         testUri = new Uri("https://google.nl/test");
            Func <Task> act     = () => DataSourceAdaptee.FetchPublicRepository(testUri);

            // Assert
            act.Should()
            .ThrowExactly <ExternalException>()
            .WithMessage(errorMessage);
        }