public void SchemesShouldConsiderOnlyReferenceIdForEquality()
        {
            // Arrange
            var securityRequirement = new OpenApiSecurityRequirement();

            var securityScheme1 = new OpenApiSecurityScheme
            {
                Type      = SecuritySchemeType.ApiKey,
                Name      = "apiKeyName1",
                In        = ParameterLocation.Header,
                Reference = new OpenApiReference
                {
                    Id   = "securityScheme1",
                    Type = ReferenceType.SecurityScheme
                }
            };

            var securityScheme2 = new OpenApiSecurityScheme
            {
                Type             = SecuritySchemeType.OpenIdConnect,
                OpenIdConnectUrl = new Uri("http://example.com"),
                Reference        = new OpenApiReference
                {
                    Id   = "securityScheme2",
                    Type = ReferenceType.SecurityScheme
                }
            };

            var securityScheme1Duplicate = new OpenApiSecurityScheme
            {
                Type      = SecuritySchemeType.ApiKey,
                Name      = "apiKeyName1",
                In        = ParameterLocation.Header,
                Reference = new OpenApiReference
                {
                    Id   = "securityScheme1",
                    Type = ReferenceType.SecurityScheme
                }
            };

            var securityScheme1WithDifferentProperties = new OpenApiSecurityScheme
            {
                Type      = SecuritySchemeType.ApiKey,
                Name      = "apiKeyName2",
                In        = ParameterLocation.Query,
                Reference = new OpenApiReference
                {
                    Id   = "securityScheme1",
                    Type = ReferenceType.SecurityScheme
                }
            };

            // Act
            securityRequirement.Add(securityScheme1, new List <string>());
            securityRequirement.Add(securityScheme2, new List <string> {
                "scope1", "scope2"
            });

            Action addSecurityScheme1Duplicate = () =>
                                                 securityRequirement.Add(securityScheme1Duplicate, new List <string>());
            Action addSecurityScheme1WithDifferentProperties = () =>
                                                               securityRequirement.Add(securityScheme1WithDifferentProperties, new List <string>());

            // Assert
            // Only the first two should be added successfully since the latter two are duplicates of securityScheme1.
            // Duplicate determination only considers Reference.Id.
            addSecurityScheme1Duplicate.ShouldThrow <ArgumentException>();
            addSecurityScheme1WithDifferentProperties.ShouldThrow <ArgumentException>();

            securityRequirement.Should().HaveCount(2);

            securityRequirement.ShouldBeEquivalentTo(
                new OpenApiSecurityRequirement
            {
                // This should work with any security scheme object
                // as long as Reference.Id os securityScheme1
                [securityScheme1WithDifferentProperties] = new List <string>(),
                [securityScheme2] = new List <string> {
                    "scope1", "scope2"
                },
            });
        }