示例#1
0
        public void Should_AbleToSetSecurityRequirementWithBuilder()
        {
            var srBuilder = new SecurityRequirementBuilder().SecurityScheme(SecuritySchemes.ApiKey);

            var swaggerRoot = GetBasicSwaggerRootBuilder().SecurityRequirement(srBuilder).Build();

            Assert.True(swaggerRoot.Security.ContainsKey(SecuritySchemes.ApiKey));
            Assert.Equal(srBuilder.Build().Value, swaggerRoot.Security[SecuritySchemes.ApiKey]);
        }
 public void Should_ThrowRequiredFieldException_WhenSchemeIsNotSet()
 {
     Assert.Throws <RequiredFieldException>(() => builder.Build());
 }