示例#1
0
            public void ShouldGetNull(string jsonDocument, bool isApplicable)
            {
                // Given
                var jsonElement = JsonDocument.Parse(jsonDocument).RootElement;

                // When
                var authenticationProvider = new CredsStoreProvider(jsonElement, TestcontainersSettings.Logger);
                var authConfig             = authenticationProvider.GetAuthConfig(DockerRegistry);

                // Then
                Assert.Equal(isApplicable, authenticationProvider.IsApplicable(DockerRegistry));
                Assert.Null(authConfig);
            }
示例#2
0
#pragma warning restore xUnit1004
            public void ShouldGetAuthConfig()
            {
                // Given
                const string jsonDocument = "{\"credsStore\":\"desktop\"}";
                var          jsonElement  = JsonDocument.Parse(jsonDocument).RootElement;

                // When
                var authenticationProvider = new CredsStoreProvider(jsonElement, TestcontainersSettings.Logger);
                var authConfig             = authenticationProvider.GetAuthConfig(DockerRegistry);

                // Then
                Assert.True(authenticationProvider.IsApplicable(DockerRegistry));
                Assert.NotNull(authConfig);
                Assert.Equal(DockerRegistry, authConfig.RegistryEndpoint);
                Assert.Equal("username", authConfig.Username);
                Assert.Equal("password", authConfig.Password);
            }