Exemplo n.º 1
0
        public async Task GenerateStartRequestDoesNotCallGitHubApi()
        {
            // Arrange
            var config = CreateProviderConfig();

            var(restClientFactory, restClient) = CreateRestClientAndFactory();

            var provider = new GitHubProvider(config, restClientFactory, "url1", "url2");

            var http = Substitute.For <HttpRequest>();

            // Act
            var result = await provider.GenerateStartRequestUrl(http);

            // Assert
            await restClient.DidNotReceive().ExecuteAsync <AccessTokenResult>(Arg.Any <IRestRequest>());
        }
Exemplo n.º 2
0
        public async Task GenerateStartRequestUrlReturnsToken()
        {
            // Arrange
            var config = CreateProviderConfig();

            var(restClientFactory, restClient) = CreateRestClientAndFactory();

            // Arrange - Calling GitHub API succeeds

            var provider = new GitHubProvider(config, restClientFactory, "url1", "url2");

            var http = Substitute.For <HttpRequest>();

            // Act
            var result = await provider.GenerateStartRequestUrl(http);

            // Assert
            Assert.NotNull(result.url);
        }