Пример #1
0
    public async Task UseWireCrypt(FbWireCrypt wireCrypt)
    {
        if (!EnsureServerVersion(new Version(3, 0, 0, 0)))
        {
            return;
        }
        if (!EnsureServerType(FbServerType.Default))
        {
            return;
        }

        var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);

        csb.WireCrypt = wireCrypt;
        await using (var conn = new FbConnection(csb.ToString()))
        {
            await conn.OpenAsync();

            const string Pattern = ":[^:]*C[^:]*$";
            if (wireCrypt == FbWireCrypt.Enabled || wireCrypt == FbWireCrypt.Required)
            {
                StringAssert.IsMatch(Pattern, conn.ServerVersion);
            }
            else
            {
                StringAssert.DoesNotMatch(Pattern, conn.ServerVersion);
            }
        }
    }
 public FbTestsBase(FbServerType serverType, bool compression, FbWireCrypt wireCrypt, bool insertTestData = true)
 {
     ServerType      = serverType;
     Compression     = compression;
     WireCrypt       = wireCrypt;
     _insertTestData = insertTestData;
 }
 protected bool EnsureWireCrypt(FbWireCrypt wireCrypt)
 {
     if (WireCrypt == wireCrypt)
     {
         return(true);
     }
     Assert.Inconclusive($"Not supported with this {nameof(FbWireCrypt)}.");
     return(false);
 }
Пример #4
0
    public static void SetUp(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
    {
        var item = Tuple.Create(serverType, compression, wireCrypt);

        if (!_initalized.Contains(item))
        {
            var cs = FbTestsBase.BuildConnectionString(serverType, compression, wireCrypt);
            FbConnection.CreateDatabase(cs, PageSize, ForcedWrite, true);
            CreateTables(cs);
            CreateProcedures(cs);
            CreateTriggers(cs);
            _initalized.Add(item);
        }
    }
Пример #5
0
        private static WireCryptOption FbWireCryptToWireCryptOption(FbWireCrypt wireCrypt)
        {
            switch (wireCrypt)
            {
            case FbWireCrypt.Disabled:
                return(WireCryptOption.Disabled);

            case FbWireCrypt.Enabled:
                return(WireCryptOption.Enabled);

            case FbWireCrypt.Required:
                return(WireCryptOption.Required);

            default:
                throw new ArgumentOutOfRangeException(nameof(wireCrypt), $"{nameof(wireCrypt)}={wireCrypt}");
            }
        }
Пример #6
0
    private FbWireCrypt GetWireCrypt(string keyword, FbWireCrypt defaultValue)
    {
        var key = GetKey(keyword);

        if (!TryGetValue(key, out var value))
        {
            return(defaultValue);
        }
        switch (value)
        {
        case FbWireCrypt fbWireCrypt:
            return(fbWireCrypt);

        case string s when Enum.TryParse <FbWireCrypt>(s, true, out var enumResult):
            return(enumResult);

        default:
            return(Common.ConnectionString.GetWireCrypt(key, base.TryGetValue, defaultValue));
        }
    }
 public TrackerIssuesTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
 public FbTimeZonesSupportTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
Пример #9
0
 public FbLongNumericsSupportTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
 public FbStoredProcedureCallsTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
Пример #11
0
 public FbCommandTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
Пример #12
0
    static TestFixtureData CreateTestFixtureData(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
    {
        var result = new TestFixtureData(serverType, compression, wireCrypt);

        result.Properties.Set(nameof(FbTestsBase.ServerType), serverType.ToString());
        result.Properties.Set(nameof(FbTestsBase.Compression), compression.ToString());
        result.Properties.Set(nameof(FbTestsBase.WireCrypt), wireCrypt.ToString());
        return(result);
    }
 public FbDecFloat16SupportTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
 public static string BuildServicesConnectionString(FbServerType serverType, bool compression, FbWireCrypt wireCrypt, bool includeDatabase)
 {
     return(BuildServicesConnectionStringBuilder(serverType, compression, wireCrypt, includeDatabase).ToString());
 }
Пример #15
0
 public static string Database(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
 {
     return($"{DatabaseBase}_{serverType}_{compression}_{wireCrypt}.fdb");
 }
Пример #16
0
 public FbBatchCommandTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt, false)
 {
     _shouldTearDown = false;
 }
 public static string BuildConnectionString(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
 {
     return(BuildConnectionStringBuilder(serverType, compression, wireCrypt).ToString());
 }
Пример #18
0
 public FbExceptionTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
Пример #19
0
 public FbImplicitTransactionTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
 public FbParameterTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
Пример #21
0
 public FbDataReaderTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
        public static FbConnectionStringBuilder BuildConnectionStringBuilder(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
        {
            var builder = new FbConnectionStringBuilder();

            builder.UserID      = FbTestsSetup.UserID;
            builder.Password    = FbTestsSetup.Password;
            builder.DataSource  = FbTestsSetup.DataSource;
            builder.Database    = FbTestsSetup.Database(serverType, compression, wireCrypt);
            builder.Port        = FbTestsSetup.Port;
            builder.Charset     = FbTestsSetup.Charset;
            builder.Pooling     = FbTestsSetup.Pooling;
            builder.ServerType  = serverType;
            builder.Compression = compression;
            builder.WireCrypt   = wireCrypt;
            return(builder);
        }
Пример #23
0
 public FbRemoteEventTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }
Пример #24
0
 internal static FbWireCrypt GetWireCrypt(string key, TryGetValueDelegate tryGetValue, FbWireCrypt defaultValue = default)
 {
     return(tryGetValue(key, out var value)
                     ? (FbWireCrypt)value
                     : defaultValue);
 }
Пример #25
0
 public FbBooleanSupportTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
     _shouldTearDown = false;
 }
Пример #26
0
 public FbInt128SupportTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt, false)
 {
 }
        public static FbConnectionStringBuilder BuildServicesConnectionStringBuilder(FbServerType serverType, bool compression, FbWireCrypt wireCrypt, bool includeDatabase)
        {
            var builder = new FbConnectionStringBuilder();

            builder.UserID     = FbTestsSetup.UserID;
            builder.Password   = FbTestsSetup.Password;
            builder.DataSource = FbTestsSetup.DataSource;
            if (includeDatabase)
            {
                builder.Database = FbTestsSetup.Database(serverType, compression, wireCrypt);
            }
            builder.ServerType = serverType;
            return(builder);
        }
Пример #28
0
 public TransactionScopeTests(FbServerType serverType, bool compression, FbWireCrypt wireCrypt)
     : base(serverType, compression, wireCrypt)
 {
 }