コード例 #1
0
        /// <summary>
        /// Determine whether a load balancing mode is configured.
        /// </summary>
        /// <param name="enabled">The expected value.</param>
        /// <param name="ignorePreviousSetup">Force creating a new connection string and ignore the value assigned by scripts. Use this argument only for local development.</param>
        public RequireServer LoadBalancing(bool enabled, bool ignorePreviousSetup = false)
        {
            var isLoadBalancing = (ignorePreviousSetup ? CoreTestConfiguration.CreateConnectionString() : CoreTestConfiguration.ConnectionString).LoadBalanced;

            if (isLoadBalancing == enabled)
            {
                return(this);
            }
            throw new SkipException($"Test skipped because load balancing mode is {(isLoadBalancing ? "on" : "off")}.");
        }