Exemplo n.º 1
0
        public RequireServerFactAttribute(string versionText = null,
                                          VersionComparison versionCompare = VersionComparison.EqualTo)
        {
            var skipText = new StringBuilder();

            if (!BoltkitHelper.ServerAvailable())
            {
                skipText.AppendLine(BoltkitHelper.TestRequireBoltkit);
            }

            if (!string.IsNullOrWhiteSpace(versionText))
            {
                var version          = ServerVersion.From(versionText);
                var availableVersion = ServerVersion.From(BoltkitHelper.ServerVersion());

                var satisfy = false;
                switch (versionCompare)
                {
                case VersionComparison.LessThan:
                    satisfy = availableVersion.CompareTo(version) < 0;
                    break;

                case VersionComparison.LessThanOrEqualTo:
                    satisfy = availableVersion.CompareTo(version) <= 0;
                    break;

                case VersionComparison.EqualTo:
                    satisfy = availableVersion.CompareTo(version) == 0;
                    break;

                case VersionComparison.GreaterThanOrEqualTo:
                    satisfy = availableVersion.CompareTo(version) >= 0;
                    break;

                case VersionComparison.GreaterThan:
                    satisfy = availableVersion.CompareTo(version) > 0;
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(versionCompare));
                }

                if (!satisfy)
                {
                    skipText.AppendLine(
                        $"Test requires available server version {availableVersion} to be {versionCompare.ToString()} {version}.");
                }
            }

            Skip = skipText.ToString();
        }
Exemplo n.º 2
0
        public RequireClusterFactAttribute(string versionText = null,
                                           VersionComparison versionCompare = VersionComparison.EqualTo)
        {
            var skipText = new StringBuilder();

            if (!BoltkitHelper.ServerAvailable())
            {
                skipText.AppendLine(BoltkitHelper.TestRequireBoltkit);
            }

            RequireServer.RequiredServerAvailable(versionText, versionCompare, skipText);

            if (skipText.Length > 0)
            {
                Skip = skipText.ToString();
            }
        }
Exemplo n.º 3
0
            public CertificateTrustIntegrationTestFixture()
            {
                if (!BoltkitHelper.ServerAvailable())
                {
                    return;
                }

                try
                {
                    Pkcs12 = CertificateUtils.CreateCert("localhost", DateTime.Now.AddYears(-1),
                                                         DateTime.Now.AddYears(1),
                                                         null, null, null);
                    StandAlone = new StandAlone(Pkcs12);
                }
                catch (Exception)
                {
                    Dispose();
                    throw;
                }
            }
        private IStandAlone CreateInstance()
        {
            if (LocalStandAloneInstance.IsServerProvided())
            {
                return(new LocalStandAloneInstance());
            }
            else
            {
                if (!BoltkitHelper.ServerAvailable())
                {
                    return(null);
                }

                try
                {
                    return(new StandAlone());
                }
                catch (Exception)
                {
                    Dispose();
                    throw;
                }
            }
        }