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); }
#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); }