예제 #1
0
        private static void CheckAuthentication(AuthenticationRequirement authentication)
        {
            switch (authentication)
            {
            case AuthenticationRequirement.Off:
                if (CoreTestConfiguration.ConnectionString.Username != null)
                {
                    throw new SkipTestException("Test skipped because authentication is on.");
                }
                return;

            case AuthenticationRequirement.On:
                if (CoreTestConfiguration.ConnectionString.Username == null)
                {
                    throw new SkipTestException("Test skipped because authentication is off.");
                }
                return;

            case AuthenticationRequirement.Unspecified:
                return;

            default:
                throw new ArgumentException($"Invalid authentication requirement: {authentication}.", nameof(authentication));
            }
        }
예제 #2
0
 public static void Where(
     AuthenticationRequirement? authentication = null,
     ClusterTypes? clusterTypes = null,
     string minimumVersion = null,
     string modules = null,
     string storageEngines = null,
     string versionLessThan = null
     )
 {
     Any();
     if (minimumVersion != null)
     {
         CheckMinimumVersion(minimumVersion);
     }
     if (versionLessThan != null)
     {
         CheckVersionLessThan(versionLessThan);
     }
     if (clusterTypes != null)
     {
         CheckClusterTypes(clusterTypes.Value);
     }
     if (modules != null)
     {
         CheckModules(modules);
     }
     if (storageEngines != null)
     {
         CheckStorageEngines(storageEngines);
     }
     if (authentication != null)
     {
         CheckAuthentication(authentication.Value);
     }
 }
예제 #3
0
 public MyAuthAttribute(AuthenticationRequirement requirement)
 {
     _requirement = requirement;
 }
예제 #4
0
 private static void CheckAuthentication(AuthenticationRequirement authentication)
 {
     switch (authentication)
     {
         case AuthenticationRequirement.Off:
             if (CoreTestConfiguration.ConnectionString.Username != null)
             {
                 throw new SkipTestException("Test skipped because authentication is on.");
             }
             return;
         case AuthenticationRequirement.On:
             if (CoreTestConfiguration.ConnectionString.Username == null)
             {
                 throw new SkipTestException("Test skipped because authentication is off.");
             }
             return;
         case AuthenticationRequirement.Unspecified:
             return;
         default:
             throw new ArgumentException($"Invalid authentication requirement: {authentication}.", nameof(authentication));
     }
 }
예제 #5
0
 public MyAuthAttribute(AuthenticationRequirement requirement)
 {
     _requirement = requirement;
 }