diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 000000000..bb92c879a
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,14 @@
+ARG INSTALL_NODE=false
+ARG INSTALL_AZURE_CLI=false
+FROM mcr.microsoft.com/vscode/devcontainers/dotnet:dev-5.0
+
+ENV DOTNET_NOLOGO=true
+ENV DOTNET_CLI_TELEMETRY_OPTOUT=true
+ENV DEVCONTAINER=true
+
+# install redis-cli and ping
+RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
+ && apt-get -y install --no-install-recommends iputils-ping redis-tools mono-runtime
+
+# install SDK 3.1
+RUN curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 3.1 --install-dir /usr/share/dotnet/
diff --git a/.devcontainer/TestConfig.json b/.devcontainer/TestConfig.json
new file mode 100644
index 000000000..2ec990b9f
--- /dev/null
+++ b/.devcontainer/TestConfig.json
@@ -0,0 +1,11 @@
+{
+ "MasterServer": "redis",
+ "ReplicaServer": "redis",
+ "SecureServer": "redis",
+ "FailoverMasterServer": "redis",
+ "FailoverReplicaServer": "redis",
+ "IPv4Server": "redis",
+ "RemoteServer": "redis",
+ "SentinelServer": "redis",
+ "ClusterServer": "redis"
+}
\ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 000000000..24c9b1186
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,17 @@
+{
+ "name": "StackExchange.Redis",
+ "dockerComposeFile": [
+ "docker-compose.yml"
+ ],
+ "service": "devcontainer",
+ "workspaceFolder": "/workspace",
+ "postCreateCommand": "dotnet restore Build.csproj",
+
+ "settings": {
+ "terminal.integrated.shell.linux": "/bin/bash"
+ },
+ "extensions": [
+ "ms-dotnettools.csharp",
+ "ms-azuretools.vscode-docker"
+ ],
+}
\ No newline at end of file
diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml
new file mode 100644
index 000000000..a801d6f1e
--- /dev/null
+++ b/.devcontainer/docker-compose.yml
@@ -0,0 +1,23 @@
+version: '3.7'
+
+services:
+ devcontainer:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ volumes:
+ - ..:/workspace:cached
+ # Mount the TestConfig.json file as readonly, so that tests talk to services in the internal docker network
+ # This leaves the original TestsConfig.json outside the devcontainer untouched
+ - ./TestConfig.json:/workspace/tests/StackExchange.Redis.Tests/TestConfig.json:ro
+ depends_on:
+ - redis
+ links:
+ - "redis:redis"
+ command: /bin/sh -c "while sleep 1000; do :; done"
+ redis:
+ build:
+ context: ../tests/RedisConfigs
+ dockerfile: Dockerfile
+ sysctls :
+ net.core.somaxconn: '511'
\ No newline at end of file
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..eb05866a0
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,213 @@
+# editorconfig.org
+root = true
+
+# Don't use tabs for indentation.
+[*]
+indent_style = space
+
+# Code files
+[*.{cs,csx,vb,vbx}]
+indent_size = 4
+insert_final_newline = true
+charset = utf-8-bom
+trim_trailing_whitespace = true
+
+# Xml project files
+[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
+indent_size = 2
+
+# Xml config files
+[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
+indent_size = 2
+
+# JSON files
+[*.json]
+indent_size = 2
+
+# Dotnet code style settings:
+[*.{cs,vb}]
+# Sort using and Import directives with System.* appearing first
+dotnet_sort_system_directives_first = true:warning
+# Avoid "this." and "Me." if not necessary
+dotnet_style_qualification_for_field = false:warning
+dotnet_style_qualification_for_property = false:warning
+dotnet_style_qualification_for_method = false:warning
+dotnet_style_qualification_for_event = false:warning
+
+# Modifiers
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
+dotnet_style_readonly_field = true:warning
+
+# Use language keywords instead of framework type names for type references
+dotnet_style_predefined_type_for_locals_parameters_members = true:warning
+dotnet_style_predefined_type_for_member_access = true:warning
+
+# Suggest more modern language features when available
+dotnet_style_object_initializer = true:warning
+dotnet_style_collection_initializer = true:warning
+dotnet_style_explicit_tuple_names = true:warning
+dotnet_style_null_propagation = true:warning
+dotnet_style_coalesce_expression = true:warning
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
+dotnet_style_prefer_auto_properties = true:suggestion
+
+# Ignore silly if statements
+dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
+dotnet_style_prefer_conditional_expression_over_return = true:suggestion
+
+# Don't warn on things that actually need suppressing
+dotnet_remove_unnecessary_suppression_exclusions = CA1009,CA1063,CA1069,CA1416,CA1816,CA1822,CA2202,CS0618,IDE0060,IDE0062,RCS1047,RCS1085,RCS1090,RCS1194,RCS1231
+
+# Style Definitions
+dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+# Use PascalCase for constant fields
+dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
+dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
+dotnet_naming_symbols.constant_fields.applicable_kinds = field
+dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
+dotnet_naming_symbols.constant_fields.required_modifiers = const
+
+# CSharp code style settings:
+[*.cs]
+# Prefer method-like constructs to have a expression-body
+csharp_style_expression_bodied_constructors = true:silent
+csharp_style_expression_bodied_methods = true:silent
+csharp_style_expression_bodied_operators = true:warning
+
+# Prefer property-like constructs to have an expression-body
+csharp_style_expression_bodied_accessors = true:warning
+csharp_style_expression_bodied_indexers = true:warning
+csharp_style_expression_bodied_properties = true:warning
+csharp_style_expression_bodied_lambdas = true:warning
+csharp_style_expression_bodied_local_functions = true:silent
+
+# Pattern matching preferences
+csharp_style_pattern_matching_over_is_with_cast_check = true:warning
+csharp_style_pattern_matching_over_as_with_null_check = true:warning
+
+# Null-checking preferences
+csharp_style_throw_expression = true:warning
+csharp_style_conditional_delegate_call = true:warning
+
+# Modifier preferences
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,volatile,async:suggestion
+
+# Expression-level preferences
+csharp_prefer_braces = true:silent
+csharp_style_deconstructed_variable_declaration = true:suggestion
+csharp_prefer_simple_default_expression = true:silent
+csharp_style_pattern_local_over_anonymous_function = true:suggestion
+csharp_style_inlined_variable_declaration = true:warning
+csharp_prefer_simple_using_statement = true:silent
+csharp_style_prefer_not_pattern = true:warning
+csharp_style_prefer_switch_expression = true:warning
+
+# Disable range operator suggestions
+csharp_style_prefer_range_operator = false:none
+csharp_style_prefer_index_operator = false:none
+
+# New line preferences
+csharp_new_line_before_open_brace = all
+csharp_new_line_before_else = true
+csharp_new_line_before_catch = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_between_query_expression_clauses = true
+
+# Indentation preferences
+csharp_indent_case_contents = true
+csharp_indent_switch_labels = true
+csharp_indent_labels = flush_left
+
+# Space preferences
+csharp_space_after_cast = false
+csharp_space_after_keywords_in_control_flow_statements = true:warning
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+
+# Wrapping preferences
+csharp_preserve_single_line_statements = true
+csharp_preserve_single_line_blocks = true
+
+# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852
+# Tags : Telemetry, EnabledRuleInAggressiveMode, CompilationEnd
+dotnet_diagnostic.CA1852.severity = warning
+
+# IDE preferences
+dotnet_diagnostic.IDE0090.severity = silent # IDE0090: Use 'new(...)'
+
+#Roslynator preferences
+dotnet_diagnostic.RCS1037.severity = error # RCS1037: Remove trailing white-space.
+dotnet_diagnostic.RCS1098.severity = none # RCS1098: Constant values should be placed on right side of comparisons.
+
+dotnet_diagnostic.RCS1194.severity = none # RCS1194: Implement exception constructors.
+dotnet_diagnostic.RCS1229.severity = none # RCS1229: Use async/await when necessary.
+dotnet_diagnostic.RCS1233.severity = none # RCS1233: Use short-circuiting operator.
+dotnet_diagnostic.RCS1234.severity = none # RCS1234: Duplicate enum value.
+
+# StyleCop preferences
+dotnet_diagnostic.SA0001.severity = none # SA0001: XML comment analysis is disabled
+
+dotnet_diagnostic.SA1101.severity = none # SA1101: Prefix local calls with this
+dotnet_diagnostic.SA1108.severity = none # SA1108: Block statements should not contain embedded comments
+dotnet_diagnostic.SA1122.severity = none # SA1122: Use string.Empty for empty strings
+dotnet_diagnostic.SA1127.severity = none # SA1127: Generic type constraints should be on their own line
+dotnet_diagnostic.SA1128.severity = none # SA1128: Put constructor initializers on their own line
+dotnet_diagnostic.SA1132.severity = none # SA1132: Do not combine fields
+dotnet_diagnostic.SA1133.severity = none # SA1133: Do not combine attributes
+
+dotnet_diagnostic.SA1200.severity = none # SA1200: Using directives should be placed correctly
+dotnet_diagnostic.SA1201.severity = none # SA1201: Elements should appear in the correct order
+dotnet_diagnostic.SA1202.severity = none # SA1202: Elements should be ordered by access
+dotnet_diagnostic.SA1203.severity = none # SA1203: Constants should appear before fields
+
+dotnet_diagnostic.SA1306.severity = none # SA1306: Field names should begin with lower-case letter
+dotnet_diagnostic.SA1309.severity = none # SA1309: Field names should not begin with underscore
+dotnet_diagnostic.SA1310.severity = silent # SA1310: Field names should not contain underscore
+dotnet_diagnostic.SA1311.severity = none # SA1311: Static readonly fields should begin with upper-case letter
+dotnet_diagnostic.SA1312.severity = none # SA1312: Variable names should begin with lower-case letter
+
+dotnet_diagnostic.SA1401.severity = silent # SA1401: Fields should be private
+dotnet_diagnostic.SA1402.severity = suggestion # SA1402: File may only contain a single type
+
+dotnet_diagnostic.SA1503.severity = silent # SA1503: Braces should not be omitted
+dotnet_diagnostic.SA1516.severity = silent # SA1516: Elements should be separated by blank line
+
+dotnet_diagnostic.SA1600.severity = none # SA1600: Elements should be documented
+dotnet_diagnostic.SA1601.severity = none # SA1601: Partial elements should be documented
+dotnet_diagnostic.SA1602.severity = none # SA1602: Enumeration items should be documented
+dotnet_diagnostic.SA1615.severity = none # SA1615: Element return value should be documented
+dotnet_diagnostic.SA1623.severity = none # SA1623: Property summary documentation should match accessors
+dotnet_diagnostic.SA1633.severity = none # SA1633: File should have header
+dotnet_diagnostic.SA1642.severity = none # SA1642: Constructor summary documentation should begin with standard text
+dotnet_diagnostic.SA1643.severity = none # SA1643: Destructor summary documentation should begin with standard text
+
+
+# To Fix:
+dotnet_diagnostic.SA1204.severity = none # SA1204: Static elements should appear before instance elements
+dotnet_diagnostic.SA1214.severity = none # SA1214: Readonly fields should appear before non-readonly fields
+dotnet_diagnostic.SA1304.severity = none # SA1304: Non-private readonly fields should begin with upper-case letter
+dotnet_diagnostic.SA1307.severity = none # SA1307: Accessible fields should begin with upper-case letter
+dotnet_diagnostic.SA1308.severity = suggestion # SA1308: Variable names should not be prefixed
+dotnet_diagnostic.SA1131.severity = none # SA1131: Use readable conditions
+dotnet_diagnostic.SA1405.severity = none # SA1405: Debug.Assert should provide message text
+dotnet_diagnostic.SA1501.severity = none # SA1501: Statement should not be on a single line
+dotnet_diagnostic.SA1502.severity = suggestion # SA1502: Element should not be on a single line
+dotnet_diagnostic.SA1513.severity = none # SA1513: Closing brace should be followed by blank line
+dotnet_diagnostic.SA1515.severity = none # SA1515: Single-line comment should be preceded by blank line
+dotnet_diagnostic.SA1611.severity = suggestion # SA1611: Element parameters should be documented
+dotnet_diagnostic.SA1649.severity = suggestion # SA1649: File name should match first type name
+
+
+
+
+
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..edc38fa76
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+* text=auto encoding=UTF-8
+*.sh text eol=lf
+*.cs diff=csharp text
\ No newline at end of file
diff --git a/.github/.github.csproj b/.github/.github.csproj
new file mode 100644
index 000000000..008099327
--- /dev/null
+++ b/.github/.github.csproj
@@ -0,0 +1,5 @@
+
+
+ net6.0
+
+
\ No newline at end of file
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
new file mode 100644
index 000000000..51f96b88d
--- /dev/null
+++ b/.github/workflows/CI.yml
@@ -0,0 +1,151 @@
+name: CI
+
+on:
+ pull_request:
+ push:
+ branches: [ 'main' ]
+ paths:
+ - '**'
+ - '!/docs/*' # Don't run workflow when files are only in the /docs directory
+
+jobs:
+ main:
+ name: StackExchange.Redis (Ubuntu)
+ runs-on: ubuntu-latest
+ env:
+ DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: "1" # Enable color output, even though the console output is redirected in Actions
+ TERM: xterm # Enable color output in GitHub Actions
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Fetch the full history
+ - name: Start Redis Services (docker-compose)
+ working-directory: ./tests/RedisConfigs
+ run: docker compose -f docker-compose.yml up -d --wait
+ - name: Install .NET SDK
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: |
+ 6.0.x
+ 8.0.x
+ 9.0.x
+ - name: .NET Build
+ run: dotnet build Build.csproj -c Release /p:CI=true
+ - name: StackExchange.Redis.Tests
+ run: dotnet test tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj -c Release --logger trx --logger GitHubActions --results-directory ./test-results/ /p:CI=true
+ - uses: dorny/test-reporter@v1
+ continue-on-error: true
+ if: success() || failure()
+ with:
+ name: Test Results - Ubuntu
+ path: 'test-results/*.trx'
+ reporter: dotnet-trx
+ - name: .NET Lib Pack
+ run: dotnet pack src/StackExchange.Redis/StackExchange.Redis.csproj --no-build -c Release /p:Packing=true /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
+
+ windows:
+ name: StackExchange.Redis (Windows Server 2022)
+ runs-on: windows-2022
+ env:
+ NUGET_CERT_REVOCATION_MODE: offline # Disabling signing because of massive perf hit, see https://github.com/NuGet/Home/issues/11548
+ DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: "1" # Note this doesn't work yet for Windows - see https://github.com/dotnet/runtime/issues/68340
+ TERM: xterm
+ DOCKER_BUILDKIT: 1
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Fetch the full history
+ - uses: Vampire/setup-wsl@v2
+ with:
+ distribution: Ubuntu-22.04
+ - name: Install Redis
+ shell: wsl-bash {0}
+ working-directory: ./tests/RedisConfigs
+ run: |
+ apt-get update
+ apt-get install curl gpg lsb-release libgomp1 jq -y
+ curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
+ chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
+ echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list
+ apt-get update
+ apt-get install -y redis
+ mkdir redis
+ - name: Run redis-server
+ shell: wsl-bash {0}
+ working-directory: ./tests/RedisConfigs/redis
+ run: |
+ pwd
+ ls .
+ # Run each server instance in order
+ redis-server ../Basic/primary-6379.conf &
+ redis-server ../Basic/replica-6380.conf &
+ redis-server ../Basic/secure-6381.conf &
+ redis-server ../Failover/primary-6382.conf &
+ redis-server ../Failover/replica-6383.conf &
+ redis-server ../Cluster/cluster-7000.conf --dir ../Cluster &
+ redis-server ../Cluster/cluster-7001.conf --dir ../Cluster &
+ redis-server ../Cluster/cluster-7002.conf --dir ../Cluster &
+ redis-server ../Cluster/cluster-7003.conf --dir ../Cluster &
+ redis-server ../Cluster/cluster-7004.conf --dir ../Cluster &
+ redis-server ../Cluster/cluster-7005.conf --dir ../Cluster &
+ redis-server ../Sentinel/redis-7010.conf &
+ redis-server ../Sentinel/redis-7011.conf &
+ redis-server ../Sentinel/sentinel-26379.conf --sentinel &
+ redis-server ../Sentinel/sentinel-26380.conf --sentinel &
+ redis-server ../Sentinel/sentinel-26381.conf --sentinel &
+ # Wait for server instances to get ready
+ sleep 5
+ echo "Checking redis-server version with port 6379"
+ redis-cli -p 6379 INFO SERVER | grep redis_version || echo "Failed to get version for port 6379"
+ echo "Checking redis-server version with port 6380"
+ redis-cli -p 6380 INFO SERVER | grep redis_version || echo "Failed to get version for port 6380"
+ echo "Checking redis-server version with port 6381"
+ redis-cli -p 6381 INFO SERVER | grep redis_version || echo "Failed to get version for port 6381"
+ echo "Checking redis-server version with port 6382"
+ redis-cli -p 6382 INFO SERVER | grep redis_version || echo "Failed to get version for port 6382"
+ echo "Checking redis-server version with port 6383"
+ redis-cli -p 6383 INFO SERVER | grep redis_version || echo "Failed to get version for port 6383"
+ echo "Checking redis-server version with port 7000"
+ redis-cli -p 7000 INFO SERVER | grep redis_version || echo "Failed to get version for port 7000"
+ echo "Checking redis-server version with port 7001"
+ redis-cli -p 7001 INFO SERVER | grep redis_version || echo "Failed to get version for port 7001"
+ echo "Checking redis-server version with port 7002"
+ redis-cli -p 7002 INFO SERVER | grep redis_version || echo "Failed to get version for port 7002"
+ echo "Checking redis-server version with port 7003"
+ redis-cli -p 7003 INFO SERVER | grep redis_version || echo "Failed to get version for port 7003"
+ echo "Checking redis-server version with port 7004"
+ redis-cli -p 7004 INFO SERVER | grep redis_version || echo "Failed to get version for port 7004"
+ echo "Checking redis-server version with port 7005"
+ redis-cli -p 7005 INFO SERVER | grep redis_version || echo "Failed to get version for port 7005"
+ echo "Checking redis-server version with port 7010"
+ redis-cli -p 7010 INFO SERVER | grep redis_version || echo "Failed to get version for port 7010"
+ echo "Checking redis-server version with port 7011"
+ redis-cli -p 7011 INFO SERVER | grep redis_version || echo "Failed to get version for port 7011"
+ echo "Checking redis-server version with port 26379"
+ redis-cli -p 26379 INFO SERVER | grep redis_version || echo "Failed to get version for port 26379"
+ echo "Checking redis-server version with port 26380"
+ redis-cli -p 26380 INFO SERVER | grep redis_version || echo "Failed to get version for port 26380"
+ echo "Checking redis-server version with port 26381"
+ redis-cli -p 26381 INFO SERVER | grep redis_version || echo "Failed to get version for port 26381"
+ continue-on-error: true
+
+ - name: .NET Build
+ run: dotnet build Build.csproj -c Release /p:CI=true
+ - name: StackExchange.Redis.Tests
+ run: dotnet test tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj -c Release --logger trx --logger GitHubActions --results-directory ./test-results/ /p:CI=true
+ - uses: dorny/test-reporter@v1
+ continue-on-error: true
+ if: success() || failure()
+ with:
+ name: Tests Results - Windows Server 2022
+ path: 'test-results/*.trx'
+ reporter: dotnet-trx
+ # Package and upload to MyGet only on pushes to main, not on PRs
+ - name: .NET Pack
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
+ run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=${env:GITHUB_WORKSPACE}\.nupkgs /p:CI=true
+ - name: Upload to MyGet
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
+ run: dotnet nuget push ${env:GITHUB_WORKSPACE}\.nupkgs\*.nupkg -s https://www.myget.org/F/stackoverflow/api/v2/package -k ${{ secrets.MYGET_API_KEY }}
\ No newline at end of file
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 000000000..53f5701f2
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,60 @@
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ 'main' ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ 'main' ]
+ schedule:
+ - cron: '8 9 * * 1'
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'csharp' ]
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
+ # Use only 'java' to analyze code written in Java, Kotlin or both
+ # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '9.0.x'
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v3
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
+ # queries: security-extended,security-and-quality
+
+ - if: matrix.language == 'csharp'
+ name: .NET Build
+ run: dotnet build Build.csproj -c Release /p:CI=true
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v3
+ with:
+ category: "/language:${{matrix.language}}"
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 57de1906d..c0024fb1f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,6 @@ obj
*.user
*.nupkg
nupkgs/
-packages/NuGet.CommandLine.*
*.sln.docstates
_ReSharper.*
Mono/
@@ -14,10 +13,19 @@ Mono/
*.rdb
*.aof
*.orig
-redis-cli.exe
-Redis Configs/*.dat
+RedisConfigs/*.dat
RedisQFork*.dat
StackExchange.Redis.*.zip
+.idea/
.vs/
+.vscode/
*.lock.json
-packages/
\ No newline at end of file
+test-results*.xml
+packages/
+StackExchange.Redis.Tests/*Config.json
+t8.shakespeare.txt
+launchSettings.json
+*.vsp
+*.diagsession
+TestResults/
+BenchmarkDotNet.Artifacts/
diff --git a/.hgignore b/.hgignore
deleted file mode 100644
index deead95ff..000000000
--- a/.hgignore
+++ /dev/null
@@ -1,20 +0,0 @@
-syntax: glob
-*/bin/
-.git
-*/obj/
-Tests/bin/
-Tests/obj/
-*.suo
-Async/bin/
-Async/obj/
-*.user
-*.nupkg
-packages/NuGet.CommandLine.*
-*.sln.docstates
-_ReSharper.*
-Mono/
-*.sln.ide
-*.rdb
-*.orig
-redis-cli.exe
-Redis Configs/*.dat
\ No newline at end of file
diff --git a/.nuget/packages.config b/.nuget/packages.config
deleted file mode 100644
index 565aa2a30..000000000
--- a/.nuget/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index 46c8bcafa..000000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "version": "0.2.0",
- "configurations": [
- {
- "name": ".NET Core Launch (console)",
- "type": "coreclr",
- "request": "launch",
- "preLaunchTask": "build",
- "program": "${workspaceRoot}\\BasicTest\\bin\\Debug\\netcoreapp1.0\\BasicTest.dll",
- "args": [],
- "cwd": "${workspaceRoot}",
- "externalConsole": false,
- "stopAtEntry": false,
- "internalConsoleOptions": "openOnSessionStart"
- },
- {
- "name": ".NET Core Attach",
- "type": "coreclr",
- "request": "attach",
- "processId": "${command.pickProcess}"
- }
- ]
-}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
deleted file mode 100644
index 863a30fd5..000000000
--- a/.vscode/tasks.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "version": "0.1.0",
- "command": "dotnet",
- "isShellCommand": true,
- "args": [],
- "tasks": [
- {
- "taskName": "build",
- "args": [
- "${workspaceRoot}\\BasicTest\\BasicTest.csproj"
- ],
- "isBuildCommand": true,
- "problemMatcher": "$msCompile"
- }
- ]
-}
\ No newline at end of file
diff --git a/BasicTest/BasicTest.csproj b/BasicTest/BasicTest.csproj
deleted file mode 100644
index 8e6c4fd98..000000000
--- a/BasicTest/BasicTest.csproj
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- StackExchange.Redis.BasicTest .NET Core
- netcoreapp1.1
- $(TargetFramework)
- BasicTest
- Exe
- BasicTest
- win7-x64
- false
-
-
-
-
-
-
-
- $(DefineConstants);CORE_CLR
-
-
-
-
-
-
-
diff --git a/BasicTest/Program.cs b/BasicTest/Program.cs
deleted file mode 100644
index 567bfc1b2..000000000
--- a/BasicTest/Program.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using StackExchange.Redis;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System;
-
-[assembly: AssemblyVersion("1.0.0")]
-
-namespace BasicTest
-{
- static class Program
- {
- static void Main()
- {
- using (var conn = ConnectionMultiplexer.Connect("127.0.0.1:6379"))
- {
- var db = conn.GetDatabase();
-
- RedisKey key = Me();
- db.KeyDelete(key);
- db.StringSet(key, "abc");
-
- string s = (string)db.ScriptEvaluate(@"
- local val = redis.call('get', KEYS[1])
- redis.call('del', KEYS[1])
- return val", new RedisKey[] { key }, flags: CommandFlags.NoScriptCache);
-
- Console.WriteLine(s);
- Console.WriteLine(db.KeyExists(key));
-
- }
- }
-
- internal static string Me([CallerMemberName] string caller = null)
- {
- return caller;
- }
- }
-}
diff --git a/Build.csproj b/Build.csproj
new file mode 100644
index 000000000..3e16e801c
--- /dev/null
+++ b/Build.csproj
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ConnectionWatcher/App.config b/ConnectionWatcher/App.config
deleted file mode 100644
index 1f6eeef12..000000000
--- a/ConnectionWatcher/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ConnectionWatcher/ConnectionWatcher.csproj b/ConnectionWatcher/ConnectionWatcher.csproj
deleted file mode 100644
index b9a01e91a..000000000
--- a/ConnectionWatcher/ConnectionWatcher.csproj
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {6756F911-BD09-4226-B597-67871DEB8ED5}
- WinExe
- Properties
- ConnectionWatcher
- ConnectionWatcher
- v4.5
- 512
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- AnyCPU
- pdbonly
- true
- bin\Verbose\
- TRACE
- prompt
- 4
- false
-
-
- true
- bin\Verbose\
- TRACE;DEBUG;VERBOSE
- full
- AnyCPU
- false
- prompt
- MinimumRecommendedRules.ruleset
- true
-
-
- true
- bin\Log Output\
- TRACE;DEBUG;LOGOUTPUT
- full
- AnyCPU
- false
- prompt
- MinimumRecommendedRules.ruleset
- true
-
-
- bin\Mono\
- TRACE
- true
- pdbonly
- AnyCPU
- false
- prompt
- MinimumRecommendedRules.ruleset
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- Form1.cs
-
-
-
-
- Form1.cs
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
-
-
-
- {7cec07f2-8c03-4c42-b048-738b215824c1}
- StackExchange.Redis_Net45
-
-
-
-
-
\ No newline at end of file
diff --git a/ConnectionWatcher/Form1.Designer.cs b/ConnectionWatcher/Form1.Designer.cs
deleted file mode 100644
index 0ff89af19..000000000
--- a/ConnectionWatcher/Form1.Designer.cs
+++ /dev/null
@@ -1,579 +0,0 @@
-namespace ConnectionWatcher
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Windows.Forms.Label label1;
- System.Windows.Forms.Label label2;
- System.Windows.Forms.Label label3;
- System.Windows.Forms.Label label4;
- System.Windows.Forms.Label label5;
- this.connect = new System.Windows.Forms.Button();
- this.console = new System.Windows.Forms.TextBox();
- this.endpoints = new System.Windows.Forms.ListBox();
- this.breakSocket = new System.Windows.Forms.Button();
- this.demandMaster = new System.Windows.Forms.Label();
- this.preferMaster = new System.Windows.Forms.Label();
- this.preferSlave = new System.Windows.Forms.Label();
- this.demandSlave = new System.Windows.Forms.Label();
- this.ticker = new System.Windows.Forms.Timer(this.components);
- this.label6 = new System.Windows.Forms.Label();
- this.redisKey = new System.Windows.Forms.Label();
- this.allowConnect = new System.Windows.Forms.CheckBox();
- this.connectionString = new System.Windows.Forms.ComboBox();
- this.clearLog = new System.Windows.Forms.Button();
- this.deslave = new System.Windows.Forms.Button();
- this.shutdown = new System.Windows.Forms.Button();
- this.deify = new System.Windows.Forms.Button();
- this.export = new System.Windows.Forms.Button();
- this.reconfigure = new System.Windows.Forms.Button();
- this.enableLog = new System.Windows.Forms.CheckBox();
- this.disconnect = new System.Windows.Forms.Button();
- this.bulkOps = new System.Windows.Forms.GroupBox();
- this.sameKey = new System.Windows.Forms.CheckBox();
- this.bulkPerThread = new System.Windows.Forms.NumericUpDown();
- this.bulkFF = new System.Windows.Forms.Button();
- this.bulkThreads = new System.Windows.Forms.NumericUpDown();
- this.bulkBatch = new System.Windows.Forms.Button();
- this.bulkSync = new System.Windows.Forms.Button();
- this.bulkAsync = new System.Windows.Forms.Button();
- this.flush = new System.Windows.Forms.Button();
- this.clearStormLog = new System.Windows.Forms.Button();
- label1 = new System.Windows.Forms.Label();
- label2 = new System.Windows.Forms.Label();
- label3 = new System.Windows.Forms.Label();
- label4 = new System.Windows.Forms.Label();
- label5 = new System.Windows.Forms.Label();
- this.bulkOps.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.bulkPerThread)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.bulkThreads)).BeginInit();
- this.SuspendLayout();
- //
- // label1
- //
- label1.AutoSize = true;
- label1.Location = new System.Drawing.Point(12, 18);
- label1.Name = "label1";
- label1.Size = new System.Drawing.Size(91, 13);
- label1.TabIndex = 2;
- label1.Text = "Connection String";
- //
- // label2
- //
- label2.AutoSize = true;
- label2.Location = new System.Drawing.Point(333, 48);
- label2.Name = "label2";
- label2.Size = new System.Drawing.Size(85, 13);
- label2.TabIndex = 6;
- label2.Text = "Demand Master:";
- //
- // label3
- //
- label3.AutoSize = true;
- label3.Location = new System.Drawing.Point(333, 76);
- label3.Name = "label3";
- label3.Size = new System.Drawing.Size(73, 13);
- label3.TabIndex = 7;
- label3.Text = "Prefer Master:";
- //
- // label4
- //
- label4.AutoSize = true;
- label4.Location = new System.Drawing.Point(333, 104);
- label4.Name = "label4";
- label4.Size = new System.Drawing.Size(68, 13);
- label4.TabIndex = 8;
- label4.Text = "Prefer Slave:";
- //
- // label5
- //
- label5.AutoSize = true;
- label5.Location = new System.Drawing.Point(333, 131);
- label5.Name = "label5";
- label5.Size = new System.Drawing.Size(80, 13);
- label5.TabIndex = 9;
- label5.Text = "Demand Slave:";
- //
- // connect
- //
- this.connect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.connect.Location = new System.Drawing.Point(808, 13);
- this.connect.Name = "connect";
- this.connect.Size = new System.Drawing.Size(75, 23);
- this.connect.TabIndex = 1;
- this.connect.Text = "Connect";
- this.connect.UseVisualStyleBackColor = true;
- this.connect.Click += new System.EventHandler(this.connect_Clicked);
- //
- // console
- //
- this.console.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.console.Location = new System.Drawing.Point(12, 261);
- this.console.Multiline = true;
- this.console.Name = "console";
- this.console.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- this.console.Size = new System.Drawing.Size(872, 312);
- this.console.TabIndex = 3;
- //
- // endpoints
- //
- this.endpoints.Enabled = false;
- this.endpoints.FormattingEnabled = true;
- this.endpoints.Location = new System.Drawing.Point(15, 39);
- this.endpoints.Name = "endpoints";
- this.endpoints.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
- this.endpoints.Size = new System.Drawing.Size(312, 160);
- this.endpoints.TabIndex = 4;
- //
- // breakSocket
- //
- this.breakSocket.Enabled = false;
- this.breakSocket.Location = new System.Drawing.Point(15, 205);
- this.breakSocket.Name = "breakSocket";
- this.breakSocket.Size = new System.Drawing.Size(120, 23);
- this.breakSocket.TabIndex = 5;
- this.breakSocket.Text = "Break Socket";
- this.breakSocket.UseVisualStyleBackColor = true;
- this.breakSocket.Click += new System.EventHandler(this.breakSocket_Click);
- //
- // demandMaster
- //
- this.demandMaster.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.demandMaster.Location = new System.Drawing.Point(424, 48);
- this.demandMaster.Name = "demandMaster";
- this.demandMaster.Size = new System.Drawing.Size(348, 23);
- this.demandMaster.TabIndex = 10;
- this.demandMaster.Text = "(timings etc)";
- //
- // preferMaster
- //
- this.preferMaster.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.preferMaster.Location = new System.Drawing.Point(424, 76);
- this.preferMaster.Name = "preferMaster";
- this.preferMaster.Size = new System.Drawing.Size(348, 23);
- this.preferMaster.TabIndex = 11;
- this.preferMaster.Text = "(timings etc)";
- //
- // preferSlave
- //
- this.preferSlave.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.preferSlave.Location = new System.Drawing.Point(424, 104);
- this.preferSlave.Name = "preferSlave";
- this.preferSlave.Size = new System.Drawing.Size(348, 23);
- this.preferSlave.TabIndex = 12;
- this.preferSlave.Text = "(timings etc)";
- //
- // demandSlave
- //
- this.demandSlave.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.demandSlave.Location = new System.Drawing.Point(424, 131);
- this.demandSlave.Name = "demandSlave";
- this.demandSlave.Size = new System.Drawing.Size(348, 23);
- this.demandSlave.TabIndex = 13;
- this.demandSlave.Text = "(timings etc)";
- //
- // ticker
- //
- this.ticker.Interval = 1000;
- this.ticker.Tick += new System.EventHandler(this.ticker_Tick);
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(333, 158);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(58, 13);
- this.label6.TabIndex = 14;
- this.label6.Text = "Redis Key:";
- //
- // redisKey
- //
- this.redisKey.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.redisKey.Location = new System.Drawing.Point(424, 158);
- this.redisKey.Name = "redisKey";
- this.redisKey.Size = new System.Drawing.Size(348, 23);
- this.redisKey.TabIndex = 15;
- this.redisKey.Text = "(timings etc)";
- //
- // allowConnect
- //
- this.allowConnect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.allowConnect.AutoSize = true;
- this.allowConnect.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.allowConnect.Checked = true;
- this.allowConnect.CheckState = System.Windows.Forms.CheckState.Checked;
- this.allowConnect.Enabled = false;
- this.allowConnect.Location = new System.Drawing.Point(525, 209);
- this.allowConnect.Name = "allowConnect";
- this.allowConnect.Size = new System.Drawing.Size(107, 17);
- this.allowConnect.TabIndex = 16;
- this.allowConnect.Text = "Allow Reconnect";
- this.allowConnect.UseVisualStyleBackColor = true;
- this.allowConnect.CheckedChanged += new System.EventHandler(this.allowConnect_CheckedChanged);
- //
- // connectionString
- //
- this.connectionString.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.connectionString.FormattingEnabled = true;
- this.connectionString.Items.AddRange(new object[] {
- "cluster:7000,cluster:7001,cluster:7002,cluster:7003,cluster:7004,cluster:7005,res" +
- "olveDns=true",
- ".,.:6380,resolveDns=true",
- "sslredis:6379,syncTimeout=10000",
- "sslredis:6380,sslHost=anyone,syncTimeout=10000"});
- this.connectionString.Location = new System.Drawing.Point(109, 15);
- this.connectionString.Name = "connectionString";
- this.connectionString.Size = new System.Drawing.Size(612, 21);
- this.connectionString.TabIndex = 17;
- this.connectionString.Text = "localhost,localhost:6380";
- //
- // clearLog
- //
- this.clearLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.clearLog.Location = new System.Drawing.Point(764, 205);
- this.clearLog.Name = "clearLog";
- this.clearLog.Size = new System.Drawing.Size(120, 23);
- this.clearLog.TabIndex = 18;
- this.clearLog.Text = "Clear Log";
- this.clearLog.UseVisualStyleBackColor = true;
- this.clearLog.Click += new System.EventHandler(this.clearLog_Click);
- //
- // deslave
- //
- this.deslave.Enabled = false;
- this.deslave.Location = new System.Drawing.Point(141, 205);
- this.deslave.Name = "deslave";
- this.deslave.Size = new System.Drawing.Size(120, 23);
- this.deslave.TabIndex = 19;
- this.deslave.Text = "Deslave";
- this.deslave.UseVisualStyleBackColor = true;
- this.deslave.Click += new System.EventHandler(this.deslave_Click);
- //
- // shutdown
- //
- this.shutdown.Enabled = false;
- this.shutdown.Location = new System.Drawing.Point(15, 234);
- this.shutdown.Name = "shutdown";
- this.shutdown.Size = new System.Drawing.Size(120, 23);
- this.shutdown.TabIndex = 20;
- this.shutdown.Text = "Shutdown";
- this.shutdown.UseVisualStyleBackColor = true;
- this.shutdown.Click += new System.EventHandler(this.shutdown_Click);
- //
- // deify
- //
- this.deify.Enabled = false;
- this.deify.Location = new System.Drawing.Point(141, 234);
- this.deify.Name = "deify";
- this.deify.Size = new System.Drawing.Size(120, 23);
- this.deify.TabIndex = 21;
- this.deify.Text = "DEIFY!";
- this.deify.UseVisualStyleBackColor = true;
- this.deify.Click += new System.EventHandler(this.deify_Click);
- //
- // export
- //
- this.export.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.export.Enabled = false;
- this.export.Location = new System.Drawing.Point(638, 205);
- this.export.Name = "export";
- this.export.Size = new System.Drawing.Size(120, 23);
- this.export.TabIndex = 22;
- this.export.Text = "Export";
- this.export.UseVisualStyleBackColor = true;
- this.export.Click += new System.EventHandler(this.export_Click);
- //
- // reconfigure
- //
- this.reconfigure.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.reconfigure.Enabled = false;
- this.reconfigure.Location = new System.Drawing.Point(638, 234);
- this.reconfigure.Name = "reconfigure";
- this.reconfigure.Size = new System.Drawing.Size(120, 23);
- this.reconfigure.TabIndex = 23;
- this.reconfigure.Text = "Reconfigure";
- this.reconfigure.UseVisualStyleBackColor = true;
- this.reconfigure.Click += new System.EventHandler(this.reconfigure_Click);
- //
- // enableLog
- //
- this.enableLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.enableLog.AutoSize = true;
- this.enableLog.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.enableLog.Checked = true;
- this.enableLog.CheckState = System.Windows.Forms.CheckState.Checked;
- this.enableLog.Location = new System.Drawing.Point(552, 238);
- this.enableLog.Name = "enableLog";
- this.enableLog.Size = new System.Drawing.Size(80, 17);
- this.enableLog.TabIndex = 24;
- this.enableLog.Text = "Enable Log";
- this.enableLog.UseVisualStyleBackColor = true;
- //
- // disconnect
- //
- this.disconnect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.disconnect.Enabled = false;
- this.disconnect.Location = new System.Drawing.Point(727, 13);
- this.disconnect.Name = "disconnect";
- this.disconnect.Size = new System.Drawing.Size(75, 23);
- this.disconnect.TabIndex = 25;
- this.disconnect.Text = "Disconnect";
- this.disconnect.UseVisualStyleBackColor = true;
- this.disconnect.Click += new System.EventHandler(this.disconnect_Click);
- //
- // bulkOps
- //
- this.bulkOps.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.bulkOps.Controls.Add(this.sameKey);
- this.bulkOps.Controls.Add(this.bulkPerThread);
- this.bulkOps.Controls.Add(this.bulkFF);
- this.bulkOps.Controls.Add(this.bulkThreads);
- this.bulkOps.Controls.Add(this.bulkBatch);
- this.bulkOps.Controls.Add(this.bulkSync);
- this.bulkOps.Controls.Add(this.bulkAsync);
- this.bulkOps.Enabled = false;
- this.bulkOps.Location = new System.Drawing.Point(778, 48);
- this.bulkOps.Name = "bulkOps";
- this.bulkOps.Size = new System.Drawing.Size(105, 151);
- this.bulkOps.TabIndex = 31;
- this.bulkOps.TabStop = false;
- this.bulkOps.Text = "Bulk Ops";
- //
- // sameKey
- //
- this.sameKey.AutoSize = true;
- this.sameKey.Checked = true;
- this.sameKey.CheckState = System.Windows.Forms.CheckState.Checked;
- this.sameKey.Location = new System.Drawing.Point(6, 109);
- this.sameKey.Name = "sameKey";
- this.sameKey.Size = new System.Drawing.Size(74, 17);
- this.sameKey.TabIndex = 35;
- this.sameKey.Text = "Same Key";
- this.sameKey.UseVisualStyleBackColor = true;
- //
- // bulkPerThread
- //
- this.bulkPerThread.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.bulkPerThread.Location = new System.Drawing.Point(52, 26);
- this.bulkPerThread.Maximum = new decimal(new int[] {
- 9999,
- 0,
- 0,
- 0});
- this.bulkPerThread.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.bulkPerThread.Name = "bulkPerThread";
- this.bulkPerThread.Size = new System.Drawing.Size(47, 20);
- this.bulkPerThread.TabIndex = 34;
- this.bulkPerThread.Value = new decimal(new int[] {
- 1000,
- 0,
- 0,
- 0});
- //
- // bulkFF
- //
- this.bulkFF.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.bulkFF.Location = new System.Drawing.Point(6, 81);
- this.bulkFF.Name = "bulkFF";
- this.bulkFF.Size = new System.Drawing.Size(47, 23);
- this.bulkFF.TabIndex = 33;
- this.bulkFF.Text = "F+F";
- this.bulkFF.UseVisualStyleBackColor = true;
- this.bulkFF.Click += new System.EventHandler(this.bulkFF_Click);
- //
- // bulkThreads
- //
- this.bulkThreads.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.bulkThreads.Location = new System.Drawing.Point(6, 26);
- this.bulkThreads.Maximum = new decimal(new int[] {
- 50,
- 0,
- 0,
- 0});
- this.bulkThreads.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.bulkThreads.Name = "bulkThreads";
- this.bulkThreads.Size = new System.Drawing.Size(47, 20);
- this.bulkThreads.TabIndex = 32;
- this.bulkThreads.Value = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- //
- // bulkBatch
- //
- this.bulkBatch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.bulkBatch.Location = new System.Drawing.Point(52, 81);
- this.bulkBatch.Name = "bulkBatch";
- this.bulkBatch.Size = new System.Drawing.Size(47, 23);
- this.bulkBatch.TabIndex = 31;
- this.bulkBatch.Text = "Batch";
- this.bulkBatch.UseVisualStyleBackColor = true;
- this.bulkBatch.Click += new System.EventHandler(this.bulkBatch_Click);
- //
- // bulkSync
- //
- this.bulkSync.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.bulkSync.Location = new System.Drawing.Point(52, 52);
- this.bulkSync.Name = "bulkSync";
- this.bulkSync.Size = new System.Drawing.Size(47, 23);
- this.bulkSync.TabIndex = 30;
- this.bulkSync.Text = "Sync";
- this.bulkSync.UseVisualStyleBackColor = true;
- this.bulkSync.Click += new System.EventHandler(this.bulkSync_Click);
- //
- // bulkAsync
- //
- this.bulkAsync.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.bulkAsync.Location = new System.Drawing.Point(6, 52);
- this.bulkAsync.Name = "bulkAsync";
- this.bulkAsync.Size = new System.Drawing.Size(47, 23);
- this.bulkAsync.TabIndex = 29;
- this.bulkAsync.Text = "Async";
- this.bulkAsync.UseVisualStyleBackColor = true;
- this.bulkAsync.Click += new System.EventHandler(this.bulkAsync_Click);
- //
- // flush
- //
- this.flush.Enabled = false;
- this.flush.Location = new System.Drawing.Point(267, 205);
- this.flush.Name = "flush";
- this.flush.Size = new System.Drawing.Size(120, 23);
- this.flush.TabIndex = 32;
- this.flush.Text = "Flush";
- this.flush.UseVisualStyleBackColor = true;
- this.flush.Click += new System.EventHandler(this.flush_Click);
- //
- // clearStormLog
- //
- this.clearStormLog.Enabled = false;
- this.clearStormLog.Location = new System.Drawing.Point(267, 234);
- this.clearStormLog.Name = "clearStormLog";
- this.clearStormLog.Size = new System.Drawing.Size(120, 23);
- this.clearStormLog.TabIndex = 33;
- this.clearStormLog.Text = "Clear Storm Log";
- this.clearStormLog.UseVisualStyleBackColor = true;
- this.clearStormLog.Click += new System.EventHandler(this.clearStormLog_Click);
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(896, 585);
- this.Controls.Add(this.clearStormLog);
- this.Controls.Add(this.flush);
- this.Controls.Add(this.bulkOps);
- this.Controls.Add(this.disconnect);
- this.Controls.Add(this.enableLog);
- this.Controls.Add(this.reconfigure);
- this.Controls.Add(this.export);
- this.Controls.Add(this.deify);
- this.Controls.Add(this.shutdown);
- this.Controls.Add(this.deslave);
- this.Controls.Add(this.clearLog);
- this.Controls.Add(this.connectionString);
- this.Controls.Add(this.allowConnect);
- this.Controls.Add(this.redisKey);
- this.Controls.Add(this.label6);
- this.Controls.Add(this.demandSlave);
- this.Controls.Add(this.preferSlave);
- this.Controls.Add(this.preferMaster);
- this.Controls.Add(this.demandMaster);
- this.Controls.Add(label5);
- this.Controls.Add(label4);
- this.Controls.Add(label3);
- this.Controls.Add(label2);
- this.Controls.Add(this.breakSocket);
- this.Controls.Add(this.endpoints);
- this.Controls.Add(this.console);
- this.Controls.Add(label1);
- this.Controls.Add(this.connect);
- this.MinimumSize = new System.Drawing.Size(540, 430);
- this.Name = "Form1";
- this.Text = "Connection Watcher";
- this.bulkOps.ResumeLayout(false);
- this.bulkOps.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.bulkPerThread)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.bulkThreads)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
- private System.Windows.Forms.Button connect;
- private System.Windows.Forms.TextBox console;
- private System.Windows.Forms.ListBox endpoints;
- private System.Windows.Forms.Button breakSocket;
- private System.Windows.Forms.Label demandMaster;
- private System.Windows.Forms.Label preferMaster;
- private System.Windows.Forms.Label preferSlave;
- private System.Windows.Forms.Label demandSlave;
- private System.Windows.Forms.Timer ticker;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label redisKey;
- private System.Windows.Forms.CheckBox allowConnect;
- private System.Windows.Forms.ComboBox connectionString;
- private System.Windows.Forms.Button clearLog;
- private System.Windows.Forms.Button deslave;
- private System.Windows.Forms.Button shutdown;
- private System.Windows.Forms.Button deify;
- private System.Windows.Forms.Button export;
- private System.Windows.Forms.Button reconfigure;
- private System.Windows.Forms.CheckBox enableLog;
- private System.Windows.Forms.Button disconnect;
- private System.Windows.Forms.NumericUpDown bulkThreads;
- private System.Windows.Forms.Button bulkBatch;
- private System.Windows.Forms.Button bulkSync;
- private System.Windows.Forms.Button bulkAsync;
- private System.Windows.Forms.GroupBox bulkOps;
- private System.Windows.Forms.Button bulkFF;
- private System.Windows.Forms.NumericUpDown bulkPerThread;
- private System.Windows.Forms.CheckBox sameKey;
- private System.Windows.Forms.Button flush;
- private System.Windows.Forms.Button clearStormLog;
- }
-}
-
diff --git a/ConnectionWatcher/Form1.cs b/ConnectionWatcher/Form1.cs
deleted file mode 100644
index 33ad0e848..000000000
--- a/ConnectionWatcher/Form1.cs
+++ /dev/null
@@ -1,621 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using StackExchange.Redis;
-
-namespace ConnectionWatcher
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- foreach(var file in Directory.GetFiles(Environment.CurrentDirectory, "Interactive_*.txt"))
- {
- File.Delete(file);
- }
- foreach (var file in Directory.GetFiles(Environment.CurrentDirectory, "Subscriber_*.txt"))
- {
- File.Delete(file);
- }
- InitializeComponent();
-
- demandMaster.Text = preferMaster.Text = demandSlave.Text = preferSlave.Text = redisKey.Text = "";
-
-#if !DEBUG
- breakSocket.Text = allowConnect.Text = "#if DEBUG";
-#endif
-#if LOGOUTPUT
- ConnectionMultiplexer.EchoPath = Environment.CurrentDirectory;
-#endif
- }
-
- protected override void OnClosing(CancelEventArgs e)
- {
- SetEnabled(false);
- }
- private void disconnect_Click(object sender, EventArgs e)
- {
- SetEnabled(false);
- }
- private void SetEnabled(bool running)
- {
- connect.Enabled = connectionString.Enabled = !running;
- shutdown.Enabled = endpoints.Enabled = deslave.Enabled = deify.Enabled = export.Enabled = reconfigure.Enabled =
- disconnect.Enabled = bulkOps.Enabled = flush.Enabled = clearStormLog.Enabled = running;
-
-#if DEBUG
- breakSocket.Enabled = allowConnect.Enabled = running;
-#endif
- if (running) ticker.Start();
- else ticker.Stop();
-
- if (muxer != null)
- {
- muxer.Dispose();
- muxer = null;
- }
- if(running)
- {
- console.Text = "";
- var options = ConfigurationOptions.Parse(connectionString.Text);
- options.AllowAdmin = true;
- options.AbortOnConnectFail = false;
- options.CertificateValidation += (sender, cert, chain, errors) =>
- {
- Log("cert issued to: " + cert.Subject);
- return true; // fingers in ears, pretend we don't know this is wrong
- };
-
- using (var logger = new StringWriter())
- {
- muxer = ConnectionMultiplexer.Connect(options, logger);
- Log(logger.ToString());
- }
- endpoints.Items.Clear();
- endpoints.Items.AddRange(Array.ConvertAll(
- muxer.GetEndPoints(), ep => new EndPointPair(muxer.GetServer(ep))));
-
- muxer.ConnectionFailed += Muxer_ConnectionFailed;
- muxer.ConnectionRestored += Muxer_ConnectionRestored;
- muxer.ErrorMessage += Muxer_ErrorMessage;
- muxer.ConfigurationChanged += Muxer_ConfigurationChanged;
- }
- }
- private void connect_Clicked(object sender, EventArgs e)
- {
- SetEnabled(true);
- }
-
- private void Muxer_ConfigurationChanged(object sender, EndPointEventArgs e)
- {
- Log("Configuration changed: " + e.EndPoint);
- }
-
- private void Muxer_ErrorMessage(object sender, RedisErrorEventArgs e)
- {
- Log(e.EndPoint + ": " + e.Message);
- }
-
- private void Muxer_ConnectionRestored(object sender, ConnectionFailedEventArgs e)
- {
- Log("Endpoint restored: " + e.EndPoint);
- }
- private void Log(string message)
- {
- if(InvokeRequired)
- {
- BeginInvoke((MethodInvoker)delegate
- {
- if (enableLog.Checked)
- console.Text = message + Environment.NewLine + console.Text;
- });
- } else
- {
- if(enableLog.Checked)
- console.Text = message + Environment.NewLine + console.Text;
- }
- }
-
- class EndPointPair
- {
- public EndPointPair(IServer server)
- {
- this.server = server;
- }
- private readonly IServer server;
- public EndPoint EndPoint { get { return server == null ? null : server.EndPoint; } }
- private string state;
-
- public override string ToString()
- {
- try
- {
- string spacer;
- switch (((uint)Thread.VolatileRead(ref loop)) % 4)
- {
- case 0: spacer = @" - "; break;
- case 1: spacer = @" \ "; break;
- case 2: spacer = @" | "; break;
- case 3: spacer = @" / "; break;
- default: spacer = " ! "; break;
- }
- return (server.IsSlave ? "S " : "M ") + EndPointCollection.ToString(EndPoint) + spacer + OpCount + ": " + state;
- }
- catch (Exception ex)
- {
- return ex.Message;
- }
-
- }
- public long OpCount { get;set; }
- int loop;
- internal void SetState(string msg)
- {
- state = msg;
- Interlocked.Increment(ref loop);
- Interlocked.Exchange(ref concern, 0);
- }
- int concern;
- internal bool Worried()
- {
- return Interlocked.Increment(ref concern) >= 5;
- }
- }
- private void Muxer_ConnectionFailed(object sender, ConnectionFailedEventArgs e)
- {
- Log("Endpoint failed: " + e.EndPoint + ", " + e.FailureType + (e.Exception == null ? "" : (", " + e.Exception.Message)));
- }
-
- private void ticker_Tick(object sender, EventArgs e)
- {
- RefreshListBox();
- if (muxer == null) return;
- if(endpoints.SelectedIndices.Count == 1)
- {
- var ep = ((EndPointPair)endpoints.SelectedItem).EndPoint;
- var server = muxer.GetServer(ep);
- Text = server.ServerType + " " + server.Version + " " + (server.IsSlave ? "slave" : "master") + "; " + server.GetCounters().ToString();
- }
- foreach (var pair in endpoints.Items.OfType())
- {
-
- if(pair.Worried())
- {
- Log("No response from " + pair.EndPoint);
- }
- var server = muxer.GetServer(pair.EndPoint, pair);
-
- var q = server.GetCounters();
- pair.OpCount = q.Interactive.OperationCount;
- if (q.TotalOutstanding > 5)
- {
- Log(q.ToString());
-//#if DEBUG
-// if(q.Interactive.PendingUnsentItems != 0 || q.Subscription.PendingUnsentItems != 0)
-// {
-// Log(((IRedisServerDebug)server).ListPending(100));
-// }
-//#endif
- }
- var ping = server.PingAsync().ContinueWith(UpdateEndPoint);
- }
-
-
- string s = Guid.NewGuid().ToString();
- redisKey.Text = s;
- RedisKey key = s;
- var db = muxer.GetDatabase(asyncState: Stopwatch.StartNew());
- db.IdentifyEndpointAsync(key, CommandFlags.DemandMaster).ContinueWith(DemandMaster);
- db.IdentifyEndpointAsync(key, CommandFlags.PreferMaster).ContinueWith(PreferMaster);
- db.IdentifyEndpointAsync(key, CommandFlags.PreferSlave).ContinueWith(PreferSlave);
- db.IdentifyEndpointAsync(key, CommandFlags.DemandSlave).ContinueWith(DemandSlave);
-
- // ThreadPool.QueueUserWorkItem(AccessSync);
-
- }
- private void AccessSync(object state)
- {
- var ep = muxer.GetEndPoints();
- for (int i = 0; i < ep.Length; i++)
- {
- try
- { muxer.GetServer(ep[i]).Ping(); }
- catch (Exception ex)
- {
- Log(ep[i] + ":" + ex.Message);
- }
- }
- }
-
- private void UpdateEndPoint(Task task)
- {
-
- string msg = ExtractMessage(task);
- var pair = (EndPointPair)task.AsyncState;
- if (pair != null)
- {
- BeginInvoke((MethodInvoker)delegate
- {
- pair.SetState(msg);
- RefreshListBox();
- });
- }
-
- }
-
- void RefreshListBox()
- {
- if (InvokeRequired)
- {
- BeginInvoke((MethodInvoker)RefreshListBox);
- }
- else
- {
- // hacky "redraw your damned text", via http://stackoverflow.com/a/4631419/23354
- // unfortunately, while this works, it breaks the selected items
- bool[] selected = new bool[endpoints.Items.Count];
- for (int i = 0; i < selected.Length; i++)
- {
- selected[i] = endpoints.GetSelected(i);
- }
- typeof(ListBox).InvokeMember("RefreshItems", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, endpoints, new object[] { });
- for (int i = 0; i < selected.Length; i++)
- {
- endpoints.SetSelected(i, selected[i]);
- }
- }
- }
-
- static string ExtractMessage(Task task)
- {
- if (task == null) return "";
- try
- {
- var status = task.Status;
- switch (status)
- {
- case TaskStatus.RanToCompletion:
- object result = task.Result;
- if(result is TimeSpan)
- {
- return ((TimeSpan)result).TotalMilliseconds.ToString("###,##0.00ms");
- }
- if(result is EndPoint)
- {
- return EndPointCollection.ToString((EndPoint)result);
- }
- return Convert.ToString(result);
- case TaskStatus.Faulted:
- return string.Join(", ", task.Exception.InnerExceptions.Select(x => x.Message));
- default:
- task.ContinueWith(x =>
- {
- try
- { // mark observed
- GC.KeepAlive(x.Exception);
- }
- catch
- { }
- }, continuationOptions: TaskContinuationOptions.OnlyOnFaulted);
- return status.ToString();
- }
- }
- catch (Exception ex)
- {
- return ex.Message;
- }
-
- }
-
- private void DemandMaster(Task task)
- {
- Write(demandMaster, task);
- }
- private void DemandSlave(Task task)
- {
- Write(demandSlave, task);
- }
- private void PreferMaster(Task task)
- {
- Write(preferMaster, task);
- }
- private void PreferSlave(Task task)
- {
- Write(preferSlave, task);
- }
-
- private void Write(Label output, Task task)
- {
- var watch = (Stopwatch)task.AsyncState;
- var elapsed = watch.Elapsed;
- output.BeginInvoke((MethodInvoker)delegate
- {
- string msg = ExtractMessage(task);
- output.Text = elapsed.TotalMilliseconds.ToString("###,##0.00ms") + ": " + msg;
- });
- }
-
- ConnectionMultiplexer muxer;
-
- private void breakSocket_Click(object sender, EventArgs e)
- {
-#if DEBUG
- foreach (var pair in endpoints.SelectedItems.OfType())
- {
- try
- {
- muxer.GetServer(pair.EndPoint).SimulateConnectionFailure();
- } catch(Exception ex)
- {
- Log(ex.Message);
- }
- }
-#endif
- }
-
- private void allowConnect_CheckedChanged(object sender, EventArgs e)
- {
-#if DEBUG
- muxer.AllowConnect = allowConnect.Checked;
-#endif
- }
-
- private void clearLog_Click(object sender, EventArgs e)
- {
- console.Text = "";
- }
-
-
-
- private void deslave_Click(object sender, EventArgs e)
- {
- foreach (var pair in endpoints.SelectedItems.OfType())
- {
- var sw = new StringWriter();
- try
- {
- muxer.GetServer(pair.EndPoint).MakeMaster(ReplicationChangeOptions.None, sw);
- } catch(Exception ex)
- {
- Log(ex.Message);
- }
- Log(sw.ToString());
- }
- }
-
- private void shutdown_Click(object sender, EventArgs e)
- {
- foreach (var pair in endpoints.SelectedItems.OfType())
- {
- try
- {
- muxer.GetServer(pair.EndPoint).Shutdown();
- } catch(Exception ex)
- {
- Log(ex.Message);
- }
- }
- }
- private void flush_Click(object sender, EventArgs e)
- {
- foreach (var pair in endpoints.SelectedItems.OfType())
- {
- try
- {
- muxer.GetServer(pair.EndPoint).FlushDatabase();
- }
- catch (Exception ex)
- {
- Log(ex.Message);
- }
- }
- }
- private void clearStormLog_Click(object sender, EventArgs e)
- {
- try
- {
- muxer.ResetStormLog();
- }
- catch (Exception ex)
- {
- Log(ex.Message);
- }
- }
-
- private void deify_Click(object sender, EventArgs e)
- {
- var items = endpoints.SelectedItems.OfType().ToList();
- if (items.Count != 1) return;
-
- var sw = new StringWriter();
- try
- {
- muxer.GetServer(items[0].EndPoint).MakeMaster(ReplicationChangeOptions.SetTiebreaker | ReplicationChangeOptions.Broadcast | ReplicationChangeOptions.EnslaveSubordinates, sw);
- } catch(Exception ex)
- {
- Log(ex.Message);
- }
- Log(sw.ToString());
- }
-
- private void export_Click(object sender, EventArgs e)
- {
- try
- {
- using (var dlg = new SaveFileDialog())
- {
- dlg.Filter = "Zip Files | *.zip";
- dlg.DefaultExt = "zip";
- if (dlg.ShowDialog(this) == DialogResult.OK)
- {
- string path = dlg.FileName;
- if(!string.IsNullOrEmpty(path))
- {
- using(var file = File.Create(path))
- {
- muxer.ExportConfiguration(file);
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- Log(ex.Message);
- }
-
- }
-
- private void reconfigure_Click(object sender, EventArgs e)
- {
- using(var writer = new StringWriter())
- {
- try
- {
- muxer.Configure(writer);
- } catch(Exception ex)
- {
- Log(ex.Message);
- }
- Log(writer.ToString());
- }
- }
-
- private void bulkSync_Click(object sender, EventArgs e)
- {
- RunConcurrent(0.1M, (db, count, key) => {
- while(count-- > 0) db.StringIncrement(key());
- return null;
- }, "Bulk sync");
- }
-
- private void bulkFF_Click(object sender, EventArgs e)
- {
- RunConcurrent(1, (db, count, key) => {
- while (count-- > 0) db.StringIncrement(key(), flags: CommandFlags.FireAndForget);
- return null;
- }, "Bulk F+F");
- }
- private void bulkAsync_Click(object sender, EventArgs e)
- {
- RunConcurrent(1, (db, count, key) => {
- while (count-- > 1) db.StringIncrementAsync(key(), flags: CommandFlags.FireAndForget);
- return db.StringIncrementAsync(key());
- }, "Bulk async");
- }
-
- private void bulkBatch_Click(object sender, EventArgs e)
- {
- RunConcurrent(1, (db, count, key) =>
- {
- var batch = db.CreateBatch();
- while (count-- > 1) batch.StringIncrementAsync(key(), flags: CommandFlags.FireAndForget);
- Task last = db.StringIncrementAsync(key());
- batch.Execute();
- return last;
- }, "Bulk batch");
- }
-
- private void RunConcurrent(decimal factor, Func, Task> work, [CallerMemberName] string caller = null, Action> whenDone = null, int timeout = 10000)
- {
- int threads = (int)bulkThreads.Value;
- int perThread = (int)(bulkPerThread.Value * factor);
- ThreadPool.QueueUserWorkItem(delegate
- {
- Func keyFunc;
- if(sameKey.Checked)
- {
- RedisKey key = Guid.NewGuid().ToString();
- keyFunc = () => key;
- } else
- {
- keyFunc = () => Guid.NewGuid().ToString();
- }
-
- Task last = null;
- var db = muxer.GetDatabase();
- db.KeyDelete(keyFunc(), CommandFlags.FireAndForget);
- try
- {
- if (work == null) return;
- if (threads < 1) return;
- Stopwatch watch = null;
- ManualResetEvent allDone = new ManualResetEvent(false);
- object token = new object();
- int active = 0;
- ThreadStart callback = delegate
- {
- lock (token)
- {
- int nowActive = Interlocked.Increment(ref active);
- if (nowActive == threads)
- {
- watch = Stopwatch.StartNew();
- Monitor.PulseAll(token);
- }
- else
- {
- Monitor.Wait(token);
- }
- }
- var result = work(db, perThread, keyFunc);
- if (result != null) Interlocked.Exchange(ref last, result);
- if (Interlocked.Decrement(ref active) == 0)
- {
- allDone.Set();
- }
- };
-
- Thread[] threadArr = new Thread[threads];
- for (int i = 0; i < threads; i++)
- {
- var thd = new Thread(callback);
- thd.Name = caller;
- threadArr[i] = thd;
- thd.Start();
- }
- if (allDone.WaitOne(timeout))
- {
- if (whenDone != null) whenDone(keyFunc);
- var result = db.StringGet(keyFunc());
- watch.Stop();
- var finalTask = Interlocked.Exchange(ref last, null);
- if (finalTask != null) Log("Last task is: " + finalTask.Status.ToString());
- Log(string.Format("{0}, {1} per-thread on {2} threads: {3:###,###,##0.##}ms, {4:###,###,##0}ops/s (result: {5})",
- caller, perThread, threads,
- watch.Elapsed.TotalMilliseconds,
- (int)((perThread * threads) / watch.Elapsed.TotalSeconds),
- result));
- }
- else
- {
- for (int i = 0; i < threads; i++)
- {
- var thd = threadArr[i];
- if (thd.IsAlive) thd.Abort();
- }
- Log(string.Format("{0} timed out", caller));
- }
- }
- catch (Exception ex)
- {
- Log(string.Format("{0} failed: {1}", caller, ex.Message));
- }
- finally
- {
- db.KeyDelete(keyFunc(), CommandFlags.FireAndForget);
- }
- });
- }
-
-
- }
-}
diff --git a/ConnectionWatcher/Form1.resx b/ConnectionWatcher/Form1.resx
deleted file mode 100644
index 70a64f64c..000000000
--- a/ConnectionWatcher/Form1.resx
+++ /dev/null
@@ -1,138 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- 17, 17
-
-
\ No newline at end of file
diff --git a/ConnectionWatcher/Program.cs b/ConnectionWatcher/Program.cs
deleted file mode 100644
index 28a135500..000000000
--- a/ConnectionWatcher/Program.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Windows.Forms;
-
-namespace ConnectionWatcher
-{
- static class Program
- {
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
- }
- }
-}
diff --git a/ConnectionWatcher/Properties/AssemblyInfo.cs b/ConnectionWatcher/Properties/AssemblyInfo.cs
deleted file mode 100644
index 6f83a467e..000000000
--- a/ConnectionWatcher/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("ConnectionWatcher")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ConnectionWatcher")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("f494c35a-e665-4f46-9906-dbb873e00b51")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ConnectionWatcher/Properties/Resources.Designer.cs b/ConnectionWatcher/Properties/Resources.Designer.cs
deleted file mode 100644
index 0981f11b5..000000000
--- a/ConnectionWatcher/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.34011
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace ConnectionWatcher.Properties
-{
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ConnectionWatcher.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/ConnectionWatcher/Properties/Resources.resx b/ConnectionWatcher/Properties/Resources.resx
deleted file mode 100644
index af7dbebba..000000000
--- a/ConnectionWatcher/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/ConnectionWatcher/Properties/Settings.Designer.cs b/ConnectionWatcher/Properties/Settings.Designer.cs
deleted file mode 100644
index 9c34a242b..000000000
--- a/ConnectionWatcher/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.34011
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace ConnectionWatcher.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/ConnectionWatcher/Properties/Settings.settings b/ConnectionWatcher/Properties/Settings.settings
deleted file mode 100644
index 39645652a..000000000
--- a/ConnectionWatcher/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 000000000..42de5875c
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,45 @@
+
+
+ 2.0.0
+ 2014 - $([System.DateTime]::Now.Year) Stack Exchange, Inc.
+ true
+ $(MSBuildThisFileDirectory)StackExchange.Redis.snk
+ $(AssemblyName)
+ strict
+ Stack Exchange, Inc.; Marc Gravell; Nick Craver
+ true
+ $(MSBuildThisFileDirectory)Shared.ruleset
+ NETSDK1069
+ $(NoWarn);NU5105;NU1507;SER001
+ https://stackexchange.github.io/StackExchange.Redis/ReleaseNotes
+ https://stackexchange.github.io/StackExchange.Redis/
+ MIT
+
+ 13
+ git
+ https://github.com/StackExchange/StackExchange.Redis/
+
+ true
+ embedded
+ en-US
+ false
+ true
+ false
+ true
+ 00240000048000009400000006020000002400005253413100040000010001007791a689e9d8950b44a9a8886baad2ea180e7a8a854f158c9b98345ca5009cdd2362c84f368f1c3658c132b3c0f74e44ff16aeb2e5b353b6e0fe02f923a050470caeac2bde47a2238a9c7125ed7dab14f486a5a64558df96640933b9f2b6db188fc4a820f96dce963b662fa8864adbff38e5b4542343f162ecdc6dad16912fff
+
+
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 000000000..687e19684
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Directory.Packages.props b/Directory.Packages.props
new file mode 100644
index 000000000..df8c078a3
--- /dev/null
+++ b/Directory.Packages.props
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Directory.build.props b/Directory.build.props
deleted file mode 100644
index 2742ab670..000000000
--- a/Directory.build.props
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
- 1.2.6
-
- 2017 Stack Exchange, Inc.
- true
- true
- ../StackExchange.Redis.snk
- $(AssemblyName)
- Stack Exchange, Inc.; marc.gravell
- true
-
- https://stackexchange.github.io/StackExchange.Redis/ReleaseNotes
- https://github.com/StackExchange/StackExchange.Redis/
- https://raw.github.com/StackExchange/StackExchange.Redis/master/LICENSE
-
- git
- https://github.com/StackExchange/StackExchange.Redis/
-
- true
- embedded
- en-US
- false
-
- net45;net46;netstandard1.5
- 4.3.0
-
-
-
-
- true
- false
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index e32afb858..db4620c99 100644
--- a/LICENSE
+++ b/LICENSE
@@ -24,11 +24,11 @@ SOFTWARE.
Third Party Licenses:
-The Redis project (http://redis.io/) is independent of this client library, and
+The Redis project (https://redis.io/) is independent of this client library, and
is licensed separately under the three clause BSD license. The full license
-information can be viewed here: http://redis.io/topics/license
+information can be viewed here: https://redis.io/topics/license
-This tool makes use of the "redis-doc" library from http://redis.io/documentation
+This tool makes use of the "redis-doc" library from https://redis.io/documentation
in the intellisense comments, which is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International license; full
details are available here:
@@ -43,5 +43,5 @@ This tool is not used in the release binaries.
The development solution uses the BookSleeve package from nuget
(https://code.google.com/p/booksleeve/) by Marc Gravell. This is licensed
under the Apache 2.0 license; full details are available here:
-http://www.apache.org/licenses/LICENSE-2.0
+https://www.apache.org/licenses/LICENSE-2.0
This tool is not used in the release binaries.
\ No newline at end of file
diff --git a/MigratedBookSleeveTestSuite/App.config b/MigratedBookSleeveTestSuite/App.config
deleted file mode 100644
index 8e1564635..000000000
--- a/MigratedBookSleeveTestSuite/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/MigratedBookSleeveTestSuite/Batches.cs b/MigratedBookSleeveTestSuite/Batches.cs
deleted file mode 100644
index 93a81043a..000000000
--- a/MigratedBookSleeveTestSuite/Batches.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using NUnit.Framework;
-
-namespace Tests
-{
- [TestFixture]
- public class Batches
- {
- [Test]
- public void TestBatchNotSent()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(0);
- conn.KeyDeleteAsync("batch");
- conn.StringSetAsync("batch", "batch-not-sent");
- var tasks = new List();
- var batch = conn.CreateBatch();
-
- tasks.Add(batch.KeyDeleteAsync("batch"));
- tasks.Add(batch.SetAddAsync("batch", "a"));
- tasks.Add(batch.SetAddAsync("batch", "b"));
- tasks.Add(batch.SetAddAsync("batch", "c"));
-
- Assert.AreEqual("batch-not-sent", (string)conn.StringGet("batch"));
- }
- }
-
- [Test]
- public void TestBatchSent()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(0);
- conn.KeyDeleteAsync("batch");
- conn.StringSetAsync("batch", "batch-sent");
- var tasks = new List();
- var batch = conn.CreateBatch();
- tasks.Add(batch.KeyDeleteAsync("batch"));
- tasks.Add(batch.SetAddAsync("batch", "a"));
- tasks.Add(batch.SetAddAsync("batch", "b"));
- tasks.Add(batch.SetAddAsync("batch", "c"));
- batch.Execute();
-
- var result = conn.SetMembersAsync("batch");
- tasks.Add(result);
- Task.WhenAll(tasks.ToArray());
-
- var arr = result.Result;
- Array.Sort(arr, (x, y) => string.Compare(x, y));
- Assert.AreEqual(3, arr.Length);
- Assert.AreEqual("a", (string)arr[0]);
- Assert.AreEqual("b", (string)arr[1]);
- Assert.AreEqual("c", (string)arr[2]);
- }
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Config.cs b/MigratedBookSleeveTestSuite/Config.cs
deleted file mode 100644
index ca0cdeeb1..000000000
--- a/MigratedBookSleeveTestSuite/Config.cs
+++ /dev/null
@@ -1,289 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Security.Authentication;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests
-{
- [TestFixture(Description = "Validates that the test environment is configured and responding")]
- public class Config
- {
- public static string CreateUniqueName()
- {
- return Guid.NewGuid().ToString("N");
- }
-
- internal static IServer GetServer(ConnectionMultiplexer conn)
- {
- return conn.GetServer(conn.GetEndPoints()[0]);
- }
-
- static readonly SocketManager socketManager = new SocketManager();
- static Config()
- {
- TaskScheduler.UnobservedTaskException += (sender, args) =>
- {
- Trace.WriteLine(args.Exception, "UnobservedTaskException");
- args.SetObserved();
- };
- }
-
- public const string LocalHost = "127.0.0.1"; //"192.168.0.10"; //"127.0.0.1";
- public const string RemoteHost = "ubuntu";
-
- const int unsecuredPort = 6379, securedPort = 6381,
- clusterPort0 = 7000, clusterPort1 = 7001, clusterPort2 = 7002;
-
-
-#if CLUSTER
- internal static RedisCluster GetCluster(TextWriter log = null)
- {
- string clusterConfiguration =
- RemoteHost + ":" + clusterPort0 + "," +
- RemoteHost + ":" + clusterPort1 + "," +
- RemoteHost + ":" + clusterPort2;
- return RedisCluster.Connect(clusterConfiguration, log);
- }
-#endif
-
- //const int unsecuredPort = 6380, securedPort = 6381;
-
- internal static ConnectionMultiplexer GetRemoteConnection(bool open = true, bool allowAdmin = false, bool waitForOpen = false, int syncTimeout = 5000, int ioTimeout = 5000)
- {
- return GetConnection(RemoteHost, unsecuredPort, open, allowAdmin, waitForOpen, syncTimeout, ioTimeout);
- }
- private static ConnectionMultiplexer GetConnection(string host, int port, bool open = true, bool allowAdmin = false, bool waitForOpen = false, int syncTimeout = 5000, int ioTimeout = 5000)
- {
- var options = new ConfigurationOptions
- {
- EndPoints = { { host, port } },
- AllowAdmin = allowAdmin,
- SyncTimeout = syncTimeout,
- SocketManager = socketManager
- };
- var conn = ConnectionMultiplexer.Connect(options);
- conn.InternalError += (s, args) =>
- {
- Trace.WriteLine(args.Exception.Message, args.Origin);
- };
- if (open)
- {
- if (waitForOpen) conn.GetDatabase().Ping();
- }
- return conn;
- }
- internal static ConnectionMultiplexer GetUnsecuredConnection(bool open = true, bool allowAdmin = false, bool waitForOpen = false, int syncTimeout = 5000, int ioTimeout = 5000)
- {
- return GetConnection(LocalHost, unsecuredPort, open, allowAdmin, waitForOpen, syncTimeout, ioTimeout);
- }
-
- internal static ConnectionMultiplexer GetSecuredConnection(bool open = true)
- {
- var options = new ConfigurationOptions
- {
- EndPoints = { { LocalHost, securedPort } },
- Password = "changeme",
- SyncTimeout = 6000,
- SocketManager = socketManager
- };
- var conn = ConnectionMultiplexer.Connect(options);
- conn.InternalError += (s, args) =>
- {
- Trace.WriteLine(args.Exception.Message, args.Origin);
- };
- return conn;
- }
-
- internal static RedisFeatures GetFeatures(ConnectionMultiplexer muxer)
- {
- return GetServer(muxer).Features;
- }
-
- [Test]
- public void CanOpenUnsecuredConnection()
- {
- using (var conn = GetUnsecuredConnection(false))
- {
- var server = GetServer(conn);
- server.Ping();
- }
- }
-
- [Test]
- public void CanOpenSecuredConnection()
- {
- using (var conn = GetSecuredConnection(false))
- {
- var server = GetServer(conn);
- server.Ping();
- }
- }
-
- [Test]
- public void CanNotOpenNonsenseConnection_IP()
- {
- Assert.Throws(() =>
- {
- var log = new StringWriter();
- try {
- using (var conn = ConnectionMultiplexer.Connect(Config.LocalHost + ":6500")) { }
- }
- finally {
- Console.WriteLine(log);
- }
- });
- }
-
- [Test]
- public void CanNotOpenNonsenseConnection_DNS()
- {
- Assert.Throws(() =>
- {
- var log = new StringWriter();
- try
- {
- using (var conn = ConnectionMultiplexer.Connect("doesnot.exist.ds.aasd981230d.com:6500", log)) { }
- }
- finally
- {
- Console.WriteLine(log);
- }
- });
- }
-
- [Test]
- public void CreateDisconnectedNonsenseConnection_IP()
- {
- var log = new StringWriter();
- try
- {
- using (var conn = ConnectionMultiplexer.Connect(Config.LocalHost + ":6500,abortConnect=false")) {
- Assert.IsFalse(conn.GetServer(conn.GetEndPoints().Single()).IsConnected);
- Assert.IsFalse(conn.GetDatabase().IsConnected(default(RedisKey)));
- }
- }
- finally
- {
- Console.WriteLine(log);
- }
- }
- [Test]
- public void CreateDisconnectedNonsenseConnection_DNS()
- {
- var log = new StringWriter();
- try
- {
- using (var conn = ConnectionMultiplexer.Connect("doesnot.exist.ds.aasd981230d.com:6500,abortConnect=false", log)) {
- Assert.IsFalse(conn.GetServer(conn.GetEndPoints().Single()).IsConnected);
- Assert.IsFalse(conn.GetDatabase().IsConnected(default(RedisKey)));
- }
- }
- finally
- {
- Console.WriteLine(log);
- }
- }
-
- [Test]
- public void SslProtocols_SingleValue()
- {
- var log = new StringWriter();
- var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls11");
- Assert.AreEqual(SslProtocols.Tls11, options.SslProtocols.Value);
- }
-
- [Test]
- public void SslProtocols_MultipleValues()
- {
- var log = new StringWriter();
- var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls11|Tls12");
- Assert.AreEqual(SslProtocols.Tls11|SslProtocols.Tls12, options.SslProtocols.Value);
- }
-
- [Test]
- public void SslProtocols_UsingIntegerValue()
- {
- var log = new StringWriter();
-
- // The below scenario is for cases where the *targeted*
- // .NET framework version (e.g. .NET 4.0) doesn't define an enum value (e.g. Tls11)
- // but the OS has been patched with support
- int integerValue = (int)(SslProtocols.Tls11 | SslProtocols.Tls12);
- var options = ConfigurationOptions.Parse("myhost,sslProtocols=" + integerValue);
- Assert.AreEqual(SslProtocols.Tls11 | SslProtocols.Tls12, options.SslProtocols.Value);
- }
-
- [Test]
- public void SslProtocols_InvalidValue()
- {
- var log = new StringWriter();
- Assert.Throws(() => ConfigurationOptions.Parse("myhost,sslProtocols=InvalidSslProtocol"));
- }
-
- [Test]
- public void ConfigurationOptionsDefaultForAzure()
- {
- var options = ConfigurationOptions.Parse("contoso.redis.cache.windows.net");
- Assert.IsTrue(options.DefaultVersion.Equals(new Version(3, 0, 0)));
- Assert.IsFalse(options.AbortOnConnectFail);
- }
-
- [Test]
- public void ConfigurationOptionsForAzureWhenSpecified()
- {
- var options = ConfigurationOptions.Parse("contoso.redis.cache.windows.net,abortConnect=true, version=2.1.1");
- Assert.IsTrue(options.DefaultVersion.Equals(new Version(2, 1, 1)));
- Assert.IsTrue(options.AbortOnConnectFail);
- }
-
- [Test]
- public void ConfigurationOptionsDefaultForAzureChina()
- {
- // added a few upper case chars to validate comparison
- var options = ConfigurationOptions.Parse("contoso.REDIS.CACHE.chinacloudapi.cn");
- Assert.IsTrue(options.DefaultVersion.Equals(new Version(3, 0, 0)));
- Assert.IsFalse(options.AbortOnConnectFail);
- }
-
- [Test]
- public void ConfigurationOptionsDefaultForAzureGermany()
- {
- var options = ConfigurationOptions.Parse("contoso.redis.cache.cloudapi.de");
- Assert.IsTrue(options.DefaultVersion.Equals(new Version(3, 0, 0)));
- Assert.IsFalse(options.AbortOnConnectFail);
- }
-
- [Test]
- public void ConfigurationOptionsDefaultForAzureUSGov()
- {
- var options = ConfigurationOptions.Parse("contoso.redis.cache.usgovcloudapi.net");
- Assert.IsTrue(options.DefaultVersion.Equals(new Version(3, 0, 0)));
- Assert.IsFalse(options.AbortOnConnectFail);
- }
-
- [Test]
- public void ConfigurationOptionsDefaultForNonAzure()
- {
- var options = ConfigurationOptions.Parse("redis.contoso.com");
- Assert.IsTrue(options.DefaultVersion.Equals(new Version(2, 0, 0)));
- Assert.IsTrue(options.AbortOnConnectFail);
- }
-
- [Test]
- public void ConfigurationOptionsDefaultWhenNoEndpointsSpecifiedYet()
- {
- var options = new ConfigurationOptions();
- Assert.IsTrue(options.DefaultVersion.Equals(new Version(2, 0, 0)));
- Assert.IsTrue(options.AbortOnConnectFail);
- }
-
- internal static void AssertNearlyEqual(double x, double y)
- {
- if (Math.Abs(x - y) > 0.00001) Assert.AreEqual(x, y);
- }
- }
-}
\ No newline at end of file
diff --git a/MigratedBookSleeveTestSuite/Connection.cs b/MigratedBookSleeveTestSuite/Connection.cs
deleted file mode 100644
index 1d86d6666..000000000
--- a/MigratedBookSleeveTestSuite/Connection.cs
+++ /dev/null
@@ -1,312 +0,0 @@
-//using BookSleeve;
-//using NUnit.Framework;
-//using System.Linq;
-//using System;
-//using System.Diagnostics;
-//using System.IO;
-//using System.Threading;
-//using System.Collections.Generic;
-//using System.Threading.Tasks;
-
-//namespace Tests
-//{
-// [TestFixture]
-// public class Connections // http://redis.io/commands#connection
-// {
-// [Test]
-// public void TestConnectWithDownedNodeMustBeFast_multipletimes()
-// {
-// for (int i = 0; i < 5; i++) TestConnectWithDownedNodeMustBeFast();
-// }
-// [Test]
-// public void TestConnectWithDownedNodeMustBeFast()
-// {
-// using (var good = ConnectionUtils.Connect(Config.LocalHost + ":6379"))
-// using (var bad = ConnectionUtils.Connect(Config.LocalHost + ":6666"))
-// {
-// Assert.IsNotNull(good, "6379 should exist for this test");
-// Assert.IsNull(bad, "6666 should not exist for this test");
-// }
-
-// StringWriter log = new StringWriter();
-// var watch = Stopwatch.StartNew();
-// using (var selected = ConnectionUtils.Connect(Config.LocalHost +":6379," + Config.LocalHost + ":6666,name=Core(Q&A)", log))
-// {}
-// watch.Stop();
-// Console.WriteLine(log);
-// Assert.Less(1, 2, "I always get this wrong!");
-// Assert.Less(watch.ElapsedMilliseconds, 1200, "I always get this wrong!");
-
-// }
-
-// [Test]
-// public void TestConnectViaSentinel()
-// {
-// string[] endpoints;
-// StringWriter sw = new StringWriter();
-// var selected = ConnectionUtils.SelectConfiguration(Config.RemoteHost+":26379,serviceName=mymaster", out endpoints, sw);
-// string log = sw.ToString();
-// Console.WriteLine(log);
-// Assert.IsNotNull(selected, NO_SERVER);
-// Assert.AreEqual(Config.RemoteHost + ":6379", selected);
-// }
-// [Test]
-// public void TestConnectViaSentinelInvalidServiceName()
-// {
-// string[] endpoints;
-// StringWriter sw = new StringWriter();
-// var selected = ConnectionUtils.SelectConfiguration(Config.RemoteHost + ":26379,serviceName=garbage", out endpoints, sw);
-// string log = sw.ToString();
-// Console.WriteLine(log);
-// Assert.IsNull(selected);
-// }
-
-// const string NO_SERVER = "No server available";
-// [Test]
-// public void TestDirectConnect()
-// {
-// string[] endpoints;
-// StringWriter sw = new StringWriter();
-// var selected = ConnectionUtils.SelectConfiguration(Config.RemoteHost + ":6379", out endpoints, sw);
-// string log = sw.ToString();
-// Console.WriteLine(log);
-// Assert.IsNotNull(selected, NO_SERVER);
-// Assert.AreEqual(Config.RemoteHost + ":6379", selected);
-
-// }
-
-
-// [Test]
-// public void TestName()
-// {
-// using (var conn = Config.GetUnsecuredConnection(open: false, allowAdmin: true))
-// {
-// string name = Config.CreateUniqueName();
-// conn.Name = name;
-// conn.Wait(conn.Open());
-// if (!conn.Features.ClientName) Assert.Inconclusive();
-// var client = conn.Wait(conn.Server.ListClients()).SingleOrDefault(c => c.Name == name);
-// Assert.IsNotNull(client, "found client");
-// }
-// }
-
-// [Test]
-// public void CheckInProgressCountersGoToZero()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.CompletionMode = ResultCompletionMode.Concurrent;
-// Task counters = null;
-// Task[] allTasks = new Task[5000];
-// for (int i = 0; i < 5000; i++)
-// {
-// var tmp = conn.Strings.Get(5, "foo" + i);
-// if (i == 2500)
-// {
-// counters = tmp.ContinueWith(x =>
-// {
-// return conn.GetCounters(false);
-// },TaskContinuationOptions.ExecuteSynchronously);
-// }
-// allTasks[i] = tmp;
-// }
-
-// var c = conn.Wait(counters);
-// Console.WriteLine("in progress during: {0}", c.AsyncCallbacksInProgress);
-// Assert.AreNotEqual(0, c.AsyncCallbacksInProgress, "async during");
-
-// conn.WaitAll(allTasks);
-// PubSub.AllowReasonableTimeToPublishAndProcess();
-// Assert.AreEqual(0, conn.GetCounters(false).AsyncCallbacksInProgress, "async @ end");
-// Assert.AreEqual(0, c.SyncCallbacksInProgress, "sync @ end");
-// }
-// }
-
-// [Test]
-// public void TestSubscriberName()
-// {
-// using (var conn = Config.GetUnsecuredConnection(open: false, allowAdmin: true))
-// {
-// string name = Config.CreateUniqueName();
-// conn.Name = name;
-// conn.Wait(conn.Open());
-// if (!conn.Features.ClientName) Assert.Inconclusive();
-// using (var subscriber = conn.GetOpenSubscriberChannel())
-// {
-// var evt = new ManualResetEvent(false);
-// var tmp = subscriber.Subscribe("test-subscriber-name", delegate
-// {
-// evt.Set();
-// });
-// subscriber.Wait(tmp);
-// conn.Publish("test-subscriber-name", "foo");
-// Assert.IsTrue(evt.WaitOne(1000), "event was set");
-// var clients = conn.Wait(conn.Server.ListClients()).Where(c => c.Name == name).ToList();
-// Assert.AreEqual(2, clients.Count, "number of clients");
-// }
-
-// }
-// }
-
-// [Test]
-// public void TestSubscriberNameOnRemote_WithName()
-// {
-// TestSubscriberNameOnRemote(true);
-// }
-// [Test]
-// public void TestSubscriberNameOnRemote_WithoutName()
-// {
-// TestSubscriberNameOnRemote(false);
-// }
-// private void TestSubscriberNameOnRemote(bool setName)
-// {
-// string id = Config.CreateUniqueName();
-
-// using (var pub = new RedisConnection(Config.RemoteHost, allowAdmin: true))
-// using (var sub = new RedisSubscriberConnection(Config.RemoteHost))
-// {
-// List errors = new List();
-// EventHandler errorHandler = (sender, args) =>
-// {
-// lock (errors) errors.Add(args.Exception.Message);
-// };
-// pub.Error += errorHandler;
-// sub.Error += errorHandler;
-
-// if (setName)
-// {
-// pub.Name = "pub_" + id;
-// sub.Name = "sub_" + id;
-// }
-// int count = 0;
-// var subscribe = sub.Subscribe("foo"+id, (key,payload) => Interlocked.Increment(ref count));
-
-// Task pOpen = pub.Open(), sOpen = sub.Open();
-// pub.WaitAll(pOpen, sOpen, subscribe);
-
-// Assert.AreEqual(0, Interlocked.CompareExchange(ref count, 0, 0), "init message count");
-// pub.Wait(pub.Publish("foo" + id, "hello"));
-
-// PubSub.AllowReasonableTimeToPublishAndProcess();
-// var clients = setName ? pub.Wait(pub.Server.ListClients()) : null;
-// Assert.AreEqual(1, Interlocked.CompareExchange(ref count, 0, 0), "got message");
-// lock (errors)
-// {
-// foreach (var error in errors)
-// {
-// Console.WriteLine(error);
-// }
-// Assert.AreEqual(0, errors.Count, "zero errors");
-// }
-// if (setName)
-// {
-// Assert.AreEqual(1, clients.Count(x => x.Name == pub.Name), "pub has name");
-// Assert.AreEqual(1, clients.Count(x => x.Name == sub.Name), "sub has name");
-// }
-// }
-
-// }
-
-// [Test]
-// public void TestForcedSubscriberName()
-// {
-// using (var conn = Config.GetUnsecuredConnection(allowAdmin: true, open: true, waitForOpen: true))
-// using (var sub = new RedisSubscriberConnection(conn.Host, conn.Port))
-// {
-// var task = sub.Subscribe("foo", delegate { });
-// string name = Config.CreateUniqueName();
-// sub.Name = name;
-// sub.SetServerVersion(new Version("2.6.9"), ServerType.Master);
-// sub.Wait(sub.Open());
-// sub.Wait(task);
-// Assert.AreEqual(1, sub.SubscriptionCount);
-
-// if (!conn.Features.ClientName) Assert.Inconclusive();
-// var clients = conn.Wait(conn.Server.ListClients()).Where(c => c.Name == name).ToList();
-// Assert.AreEqual(1, clients.Count, "number of clients");
-// }
-// }
-
-// [Test]
-// public void TestNameViaConnect()
-// {
-// string name = Config.CreateUniqueName();
-// using (var conn = ConnectionUtils.Connect(Config.RemoteHost+",allowAdmin=true,name=" + name))
-// {
-// Assert.IsNotNull(conn, NO_SERVER, "connection");
-// Assert.AreEqual(name, conn.Name, "connection name");
-// if (!conn.Features.ClientName) Assert.Inconclusive();
-// var client = conn.Wait(conn.Server.ListClients()).SingleOrDefault(c => c.Name == name);
-// Assert.IsNotNull(client, "find client");
-// }
-// }
-
-// // AUTH is already tested by secured connection
-
-// // QUIT is implicit in dispose
-
-// // ECHO has little utility in an application
-
-// [Test]
-// public void TestGetSetOnDifferentDbHasDifferentValues()
-// {
-// // note: we don't expose SELECT directly, but we can verify that we have different DBs in play:
-
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.Set(1, "select", "abc");
-// conn.Strings.Set(2, "select", "def");
-// var x = conn.Strings.GetString(1, "select");
-// var y = conn.Strings.GetString(2, "select");
-// conn.WaitAll(x, y);
-// Assert.AreEqual("abc", x.Result);
-// Assert.AreEqual("def", y.Result);
-// }
-// }
-// [Test, ExpectedException(typeof(ArgumentOutOfRangeException))]
-// public void TestGetOnInvalidDbThrows()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.GetString(-1, "select");
-// }
-// }
-
-
-// [Test]
-// public void Ping()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// var ms = conn.Wait(conn.Server.Ping());
-// Assert.GreaterOrEqual(ms, 0);
-// }
-// }
-
-// [Test]
-// public void CheckCounters()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen:true))
-// {
-// conn.Wait(conn.Strings.GetString(0, "CheckCounters"));
-// var first = conn.GetCounters();
-
-// conn.Wait(conn.Strings.GetString(0, "CheckCounters"));
-// var second = conn.GetCounters();
-// // +2 = ping + one select
-// Assert.AreEqual(first.MessagesSent + 2, second.MessagesSent, "MessagesSent");
-// Assert.AreEqual(first.MessagesReceived + 2, second.MessagesReceived, "MessagesReceived");
-// Assert.AreEqual(0, second.ErrorMessages, "ErrorMessages");
-// Assert.AreEqual(0, second.MessagesCancelled, "MessagesCancelled");
-// Assert.AreEqual(0, second.SentQueue, "SentQueue");
-// Assert.AreEqual(0, second.UnsentQueue, "UnsentQueue");
-// Assert.AreEqual(0, second.QueueJumpers, "QueueJumpers");
-// Assert.AreEqual(0, second.Timeouts, "Timeouts");
-// Assert.IsTrue(second.Ping >= 0, "Ping");
-// Assert.IsTrue(second.ToString().Length > 0, "ToString");
-// }
-// }
-
-
-// }
-//}
diff --git a/MigratedBookSleeveTestSuite/Constraints.cs b/MigratedBookSleeveTestSuite/Constraints.cs
deleted file mode 100644
index 629b06fed..000000000
--- a/MigratedBookSleeveTestSuite/Constraints.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System.Threading.Tasks;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests
-{
- [TestFixture]
- public class Constraints
- {
- [Test]
- public void ValueEquals()
- {
- RedisValue x = 1, y = "1";
- Assert.IsTrue(x.Equals(y), "equals");
- Assert.IsTrue(x == y, "operator");
-
- }
-
- [Test]
- public void TestManualIncr()
- {
- using (var muxer = Config.GetUnsecuredConnection(syncTimeout: 120000)) // big timeout while debugging
- {
- var conn = muxer.GetDatabase(0);
- for (int i = 0; i < 200; i++)
- {
- conn.KeyDelete("foo");
- Assert.AreEqual(1, conn.Wait(ManualIncr(conn, "foo")));
- Assert.AreEqual(2, conn.Wait(ManualIncr(conn, "foo")));
- Assert.AreEqual(2, (long)conn.StringGet("foo"));
- }
- }
-
- }
-
- public async Task ManualIncr(IDatabase connection, string key)
- {
- var oldVal = (long?)await connection.StringGetAsync(key).ConfigureAwait(false);
- var newVal = (oldVal ?? 0) + 1;
- var tran = connection.CreateTransaction();
- { // check hasn't changed
-
-#pragma warning disable 4014
- tran.AddCondition(Condition.StringEqual(key, oldVal));
- tran.StringSetAsync(key, newVal);
-#pragma warning restore 4014
- if (!await tran.ExecuteAsync().ConfigureAwait(false)) return null; // aborted
- return newVal;
- }
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Hashes.cs b/MigratedBookSleeveTestSuite/Hashes.cs
deleted file mode 100644
index 6fd98d654..000000000
--- a/MigratedBookSleeveTestSuite/Hashes.cs
+++ /dev/null
@@ -1,507 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests
-{
- [TestFixture]
- public class Hashes // http://redis.io/commands#hash
- {
- [Test]
- public void TestIncrBy()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(5);
- conn.KeyDeleteAsync("hash-test");
- for (int i = 1; i < 1000; i++)
- {
- Assert.AreEqual(i, conn.HashIncrementAsync("hash-test", "a", 1).Result);
- Assert.AreEqual(-i, conn.HashIncrementAsync("hash-test", "b", -1).Result);
- //Assert.AreEqual(i, conn.Wait(conn.Hashes.Increment(5, "hash-test", "a", 1)));
- //Assert.AreEqual(-i, conn.Wait(conn.Hashes.Increment(5, "hash-test", "b", -1)));
- }
- }
- }
-
- [Test]
- public void Scan()
- {
- using (var muxer = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- if (!Config.GetFeatures(muxer).Scan) Assert.Inconclusive();
- const int db = 3;
- var conn = muxer.GetDatabase(db);
-
- const string key = "hash-scan";
- conn.KeyDeleteAsync(key);
- conn.HashSetAsync(key, "abc", "def");
- conn.HashSetAsync(key, "ghi", "jkl");
- conn.HashSetAsync(key, "mno", "pqr");
-
- var t1 = conn.HashScan(key);
- var t2 = conn.HashScan(key, "*h*");
- var t3 = conn.HashScan(key);
- var t4 = conn.HashScan(key, "*h*");
-
- var v1 = t1.ToArray();
- var v2 = t2.ToArray();
- var v3 = t3.ToArray();
- var v4 = t4.ToArray();
-
- Assert.AreEqual(3, v1.Length);
- Assert.AreEqual(1, v2.Length);
- Assert.AreEqual(3, v3.Length);
- Assert.AreEqual(1, v4.Length);
- Array.Sort(v1, (x, y) => string.Compare(x.Name, y.Name));
- Array.Sort(v2, (x, y) => string.Compare(x.Name, y.Name));
- Array.Sort(v3, (x, y) => string.Compare(x.Name, y.Name));
- Array.Sort(v4, (x, y) => string.Compare(x.Name, y.Name));
-
- Assert.AreEqual("abc=def,ghi=jkl,mno=pqr", string.Join(",", v1.Select(pair => pair.Name + "=" + (string)pair.Value)));
- Assert.AreEqual("ghi=jkl", string.Join(",", v2.Select(pair => pair.Name + "=" + (string)pair.Value)));
- Assert.AreEqual("abc=def,ghi=jkl,mno=pqr", string.Join(",", v3.Select(pair => pair.Name + "=" + pair.Value)));
- Assert.AreEqual("ghi=jkl", string.Join(",", v4.Select(pair => pair.Name + "=" + pair.Value)));
- }
- }
- [Test]
- public void TestIncrementOnHashThatDoesntExist()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(0);
- conn.KeyDeleteAsync("keynotexist");
- var result1 = conn.Wait(conn.HashIncrementAsync("keynotexist", "fieldnotexist", 1));
- var result2 = conn.Wait(conn.HashIncrementAsync("keynotexist", "anotherfieldnotexist", 1));
- Assert.AreEqual(1, result1);
- Assert.AreEqual(1, result2);
- }
- }
- [Test]
- public void TestIncrByFloat()
- {
- using (var muxer = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- var conn = muxer.GetDatabase(5);
- if (!Config.GetFeatures(muxer).IncrementFloat) Assert.Inconclusive();
- {
- conn.KeyDeleteAsync("hash-test");
- for (int i = 1; i < 1000; i++)
- {
- Assert.AreEqual((double)i, conn.HashIncrementAsync("hash-test", "a", 1.0).Result);
- Assert.AreEqual((double)(-i), conn.HashIncrementAsync("hash-test", "b", -1.0).Result);
- }
- }
- }
- }
-
-
- [Test]
- public void TestGetAll()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(6);
- const string key = "hash test";
- conn.KeyDeleteAsync(key);
- var shouldMatch = new Dictionary();
- var random = new Random();
-
- for (int i = 1; i < 1000; i++)
- {
- var guid = Guid.NewGuid();
- var value = random.Next(Int32.MaxValue);
-
- shouldMatch[guid] = value;
-
- var x = conn.HashIncrementAsync(key, guid.ToString(), value).Result; // Kill Async
- }
-#pragma warning disable 618
- var inRedis = conn.HashGetAllAsync(key).Result.ToDictionary(
- x => Guid.Parse(x.Name), x => int.Parse(x.Value));
-#pragma warning restore 618
-
- Assert.AreEqual(shouldMatch.Count, inRedis.Count);
-
- foreach (var k in shouldMatch.Keys)
- {
- Assert.AreEqual(shouldMatch[k], inRedis[k]);
- }
- }
- }
-
- [Test]
- public void TestGet()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var key = "hash test";
- var conn = muxer.GetDatabase(6);
- var shouldMatch = new Dictionary();
- var random = new Random();
-
- for (int i = 1; i < 1000; i++)
- {
- var guid = Guid.NewGuid();
- var value = random.Next(Int32.MaxValue);
-
- shouldMatch[guid] = value;
-
- var x = conn.HashIncrementAsync(key, guid.ToString(), value).Result; // Kill Async
- }
-
- foreach (var k in shouldMatch.Keys)
- {
- var inRedis = conn.HashGetAsync(key, k.ToString()).Result;
- var num = int.Parse((string)inRedis);
-
- Assert.AreEqual(shouldMatch[k], num);
- }
- }
- }
-
- [Test]
- public void TestSet() // http://redis.io/commands/hset
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
-
- var val0 = conn.HashGetAsync("hashkey", "field");
- var set0 = conn.HashSetAsync("hashkey", "field", "value1");
- var val1 = conn.HashGetAsync("hashkey", "field");
- var set1 = conn.HashSetAsync("hashkey", "field", "value2");
- var val2 = conn.HashGetAsync("hashkey", "field");
-
- var set2 = conn.HashSetAsync("hashkey", "field-blob", Encoding.UTF8.GetBytes("value3"));
- var val3 = conn.HashGetAsync("hashkey", "field-blob");
-
- var set3 = conn.HashSetAsync("hashkey", "empty_type1", "");
- var val4 = conn.HashGetAsync("hashkey", "empty_type1");
- var set4 = conn.HashSetAsync("hashkey", "empty_type2", RedisValue.EmptyString);
- var val5 = conn.HashGetAsync("hashkey", "empty_type2");
-
- Assert.AreEqual(null, (string)val0.Result);
- Assert.AreEqual(true, set0.Result);
- Assert.AreEqual("value1", (string)val1.Result);
- Assert.AreEqual(false, set1.Result);
- Assert.AreEqual("value2", (string)val2.Result);
-
- Assert.AreEqual(true, set2.Result);
- Assert.AreEqual("value3", (string)val3.Result);
-
- Assert.AreEqual(true, set3.Result);
- Assert.AreEqual("", (string)val4.Result);
- Assert.AreEqual(true, set4.Result);
- Assert.AreEqual("", (string)val5.Result);
- }
- }
- [Test]
- public void TestSetNotExists() // http://redis.io/commands/hsetnx
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
-
- var val0 = conn.HashGetAsync("hashkey", "field");
- var set0 = conn.HashSetAsync("hashkey", "field", "value1", When.NotExists);
- var val1 = conn.HashGetAsync("hashkey", "field");
- var set1 = conn.HashSetAsync("hashkey", "field", "value2", When.NotExists);
- var val2 = conn.HashGetAsync("hashkey", "field");
-
- var set2 = conn.HashSetAsync("hashkey", "field-blob", Encoding.UTF8.GetBytes("value3"), When.NotExists);
- var val3 = conn.HashGetAsync("hashkey", "field-blob");
- var set3 = conn.HashSetAsync("hashkey", "field-blob", Encoding.UTF8.GetBytes("value3"), When.NotExists);
-
- Assert.AreEqual(null, (string)val0.Result);
- Assert.AreEqual(true, set0.Result);
- Assert.AreEqual("value1", (string)val1.Result);
- Assert.AreEqual(false, set1.Result);
- Assert.AreEqual("value1", (string)val2.Result);
-
- Assert.AreEqual(true, set2.Result);
- Assert.AreEqual("value3", (string)val3.Result);
- Assert.AreEqual(false, set3.Result);
-
- }
- }
- [Test]
- public void TestDelSingle() // http://redis.io/commands/hdel
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
- var del0 = conn.HashDeleteAsync("hashkey", "field");
-
- conn.HashSetAsync("hashkey", "field", "value");
-
- var del1 = conn.HashDeleteAsync("hashkey", "field");
- var del2 = conn.HashDeleteAsync("hashkey", "field");
-
- Assert.AreEqual(false, del0.Result);
- Assert.AreEqual(true, del1.Result);
- Assert.AreEqual(false, del2.Result);
-
- }
- }
- [Test]
- public void TestDelMulti() // http://redis.io/commands/hdel
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(3);
- conn.HashSetAsync("TestDelMulti", "key1", "val1");
- conn.HashSetAsync("TestDelMulti", "key2", "val2");
- conn.HashSetAsync("TestDelMulti", "key3", "val3");
-
- var s1 = conn.HashExistsAsync("TestDelMulti", "key1");
- var s2 = conn.HashExistsAsync("TestDelMulti", "key2");
- var s3 = conn.HashExistsAsync("TestDelMulti", "key3");
-
- var removed = conn.HashDeleteAsync("TestDelMulti", new RedisValue[] { "key1", "key3" });
-
- var d1 = conn.HashExistsAsync("TestDelMulti", "key1");
- var d2 = conn.HashExistsAsync("TestDelMulti", "key2");
- var d3 = conn.HashExistsAsync("TestDelMulti", "key3");
-
- Assert.IsTrue(conn.Wait(s1));
- Assert.IsTrue(conn.Wait(s2));
- Assert.IsTrue(conn.Wait(s3));
-
- Assert.AreEqual(2, conn.Wait(removed));
-
- Assert.IsFalse(conn.Wait(d1));
- Assert.IsTrue(conn.Wait(d2));
- Assert.IsFalse(conn.Wait(d3));
-
- var removeFinal = conn.HashDeleteAsync("TestDelMulti", new RedisValue[] { "key2" });
-
- Assert.AreEqual(0, conn.Wait(conn.HashLengthAsync("TestDelMulti")));
- Assert.AreEqual(1, conn.Wait(removeFinal));
- }
- }
-
- [Test]
- public void TestDelMultiInsideTransaction() // http://redis.io/commands/hdel
- {
- using (var outer = Config.GetUnsecuredConnection())
- {
-
- var conn = outer.GetDatabase(3).CreateTransaction();
- {
- conn.HashSetAsync("TestDelMulti", "key1", "val1");
- conn.HashSetAsync("TestDelMulti", "key2", "val2");
- conn.HashSetAsync("TestDelMulti", "key3", "val3");
-
- var s1 = conn.HashExistsAsync("TestDelMulti", "key1");
- var s2 = conn.HashExistsAsync("TestDelMulti", "key2");
- var s3 = conn.HashExistsAsync("TestDelMulti", "key3");
-
- var removed = conn.HashDeleteAsync("TestDelMulti", new RedisValue[] { "key1", "key3" });
-
- var d1 = conn.HashExistsAsync("TestDelMulti", "key1");
- var d2 = conn.HashExistsAsync("TestDelMulti", "key2");
- var d3 = conn.HashExistsAsync("TestDelMulti", "key3");
-
- conn.Execute();
-
- Assert.IsTrue(conn.Wait(s1));
- Assert.IsTrue(conn.Wait(s2));
- Assert.IsTrue(conn.Wait(s3));
-
- Assert.AreEqual(2, conn.Wait(removed));
-
- Assert.IsFalse(conn.Wait(d1));
- Assert.IsTrue(conn.Wait(d2));
- Assert.IsFalse(conn.Wait(d3));
- }
-
- }
- }
- [Test]
- public void TestExists() // http://redis.io/commands/hexists
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
- var ex0 = conn.HashExistsAsync("hashkey", "field");
- conn.HashSetAsync("hashkey", "field", "value");
- var ex1 = conn.HashExistsAsync("hashkey", "field");
- conn.HashDeleteAsync("hashkey", "field");
- var ex2 = conn.HashExistsAsync("hashkey", "field");
-
- Assert.AreEqual(false, ex0.Result);
- Assert.AreEqual(true, ex1.Result);
- Assert.AreEqual(false, ex0.Result);
-
- }
- }
-
- [Test]
- public void TestHashKeys() // http://redis.io/commands/hkeys
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
-
- var keys0 = conn.HashKeysAsync("hashkey");
-
- conn.HashSetAsync("hashkey", "foo", "abc");
- conn.HashSetAsync("hashkey", "bar", "def");
-
- var keys1 = conn.HashKeysAsync("hashkey");
-
- Assert.AreEqual(0, keys0.Result.Length);
-
- var arr = keys1.Result;
- Assert.AreEqual(2, arr.Length);
- Assert.AreEqual("foo", (string)arr[0]);
- Assert.AreEqual("bar", (string)arr[1]);
-
- }
- }
-
- [Test]
- public void TestHashValues() // http://redis.io/commands/hvals
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
-
- var keys0 = conn.HashValuesAsync("hashkey");
-
- conn.HashSetAsync("hashkey", "foo", "abc");
- conn.HashSetAsync("hashkey", "bar", "def");
-
- var keys1 = conn.HashValuesAsync("hashkey");
-
- Assert.AreEqual(0, keys0.Result.Length);
-
- var arr = keys1.Result;
- Assert.AreEqual(2, arr.Length);
- Assert.AreEqual("abc", Encoding.UTF8.GetString(arr[0]));
- Assert.AreEqual("def", Encoding.UTF8.GetString(arr[1]));
-
- }
- }
-
- [Test]
- public void TestHashLength() // http://redis.io/commands/hlen
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
-
- var len0 = conn.HashLengthAsync("hashkey");
-
- conn.HashSetAsync("hashkey", "foo", "abc");
- conn.HashSetAsync("hashkey", "bar", "def");
-
- var len1 = conn.HashLengthAsync("hashkey");
-
- Assert.AreEqual(0, len0.Result);
- Assert.AreEqual(2, len1.Result);
-
- }
- }
-
- [Test]
- public void TestGetMulti() // http://redis.io/commands/hmget
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
-
- RedisValue[] fields = { "foo", "bar", "blop" };
- var result0 = conn.HashGetAsync("hashkey", fields);
-
- conn.HashSetAsync("hashkey", "foo", "abc");
- conn.HashSetAsync("hashkey", "bar", "def");
-
- var result1 = conn.HashGetAsync("hashkey", fields);
-
- var result2 = conn.HashGetAsync("hashkey", fields);
-
- var arr0 = result0.Result;
- var arr1 = result1.Result;
- var arr2 = result2.Result;
-
- Assert.AreEqual(3, arr0.Length);
- Assert.IsNull((string)arr0[0]);
- Assert.IsNull((string)arr0[1]);
- Assert.IsNull((string)arr0[2]);
-
- Assert.AreEqual(3, arr1.Length);
- Assert.AreEqual("abc", (string)arr1[0]);
- Assert.AreEqual("def", (string)arr1[1]);
- Assert.IsNull((string)arr1[2]);
-
- Assert.AreEqual(3, arr2.Length);
- Assert.AreEqual("abc", (string)arr2[0]);
- Assert.AreEqual("def", (string)arr2[1]);
- Assert.IsNull((string)arr2[2]);
- }
- }
-
- [Test]
- public void TestGetPairs() // http://redis.io/commands/hgetall
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
-
- var result0 = conn.HashGetAllAsync("hashkey");
-
- conn.HashSetAsync("hashkey", "foo", "abc");
- conn.HashSetAsync("hashkey", "bar", "def");
-
- var result1 = conn.HashGetAllAsync("hashkey");
-
- Assert.AreEqual(0, result0.Result.Length);
- var result = result1.Result.ToStringDictionary();
- Assert.AreEqual(2, result.Count);
- Assert.AreEqual("abc", result["foo"]);
- Assert.AreEqual("def", result["bar"]);
- }
- }
-
- [Test]
- public void TestSetPairs() // http://redis.io/commands/hmset
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(9);
- conn.KeyDeleteAsync("hashkey");
-
- var result0 = conn.HashGetAllAsync("hashkey");
-
- var data = new HashEntry[] {
- new HashEntry("foo", Encoding.UTF8.GetBytes("abc")),
- new HashEntry("bar", Encoding.UTF8.GetBytes("def"))
- };
- conn.HashSetAsync("hashkey", data);
-
- var result1 = conn.HashGetAllAsync("hashkey");
-
- Assert.AreEqual(0, result0.Result.Length);
- var result = result1.Result.ToStringDictionary();
- Assert.AreEqual(2, result.Count);
- Assert.AreEqual("abc", result["foo"]);
- Assert.AreEqual("def", result["bar"]);
- }
- }
-
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Issues/Issue10.cs b/MigratedBookSleeveTestSuite/Issues/Issue10.cs
deleted file mode 100644
index 01afcd913..000000000
--- a/MigratedBookSleeveTestSuite/Issues/Issue10.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using NUnit.Framework;
-
-namespace Tests.Issues
-{
- [TestFixture]
- public class Issue10
- {
- [Test]
- public void Execute()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- const int DB = 5;
- const string Key = "issue-10-list";
- var conn = muxer.GetDatabase(DB);
- conn.KeyDeleteAsync(Key); // contents: nil
- conn.ListLeftPushAsync(Key, "abc"); // "abc"
- conn.ListLeftPushAsync(Key, "def"); // "def", "abc"
- conn.ListLeftPushAsync(Key, "ghi"); // "ghi", "def", "abc",
- conn.ListSetByIndexAsync(Key, 1, "jkl"); // "ghi", "jkl", "abc"
-
- var contents = conn.Wait(conn.ListRangeAsync(Key, 0, -1));
- Assert.AreEqual(3, contents.Length);
- Assert.AreEqual("ghi", (string)contents[0]);
- Assert.AreEqual("jkl", (string)contents[1]);
- Assert.AreEqual("abc", (string)contents[2]);
- }
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Issues/Massive Delete.cs b/MigratedBookSleeveTestSuite/Issues/Massive Delete.cs
deleted file mode 100644
index de8f9d6fa..000000000
--- a/MigratedBookSleeveTestSuite/Issues/Massive Delete.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-using NUnit.Framework;
-
-namespace Tests.Issues
-{
- [TestFixture]
- public class Massive_Delete
- {
- [OneTimeSetUpAttribute]
- public void Init()
- {
- using (var muxer = Config.GetUnsecuredConnection(allowAdmin: true))
- {
- Config.GetServer(muxer).FlushDatabase(db);
- Task last = null;
- var conn = muxer.GetDatabase(db);
- for (int i = 0; i < 100000; i++)
- {
- string key = "key" + i;
- conn.StringSetAsync(key, key);
- last = conn.SetAddAsync(todoKey, key);
- }
- conn.Wait(last);
- }
- }
-
- const int db = 4;
- const string todoKey = "todo";
-
- [Test]
- public void ExecuteMassiveDelete()
- {
- var watch = Stopwatch.StartNew();
- using (var muxer = Config.GetUnsecuredConnection())
- using (var throttle = new SemaphoreSlim(1))
- {
- var conn = muxer.GetDatabase(db);
- var originallyTask = conn.SetLengthAsync(todoKey);
- int keepChecking = 1;
- Task last = null;
- while (Volatile.Read(ref keepChecking) == 1)
- {
- throttle.Wait(); // acquire
- conn.SetPopAsync(todoKey).ContinueWith(task =>
- {
- throttle.Release();
- if (task.IsCompleted)
- {
- if ((string)task.Result == null)
- {
- Volatile.Write(ref keepChecking, 0);
- }
- else
- {
- last = conn.KeyDeleteAsync((string)task.Result);
- }
- }
- });
- }
- if (last != null)
- {
- conn.Wait(last);
- }
- watch.Stop();
- long originally = conn.Wait(originallyTask),
- remaining = conn.SetLength(todoKey);
- Console.WriteLine("From {0} to {1}; {2}ms", originally, remaining,
- watch.ElapsedMilliseconds);
-
- var counters = Config.GetServer(muxer).GetCounters();
- Console.WriteLine("Completions: {0} sync, {1} async", counters.Interactive.CompletedSynchronously, counters.Interactive.CompletedAsynchronously);
- }
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Issues/SO10504853.cs b/MigratedBookSleeveTestSuite/Issues/SO10504853.cs
deleted file mode 100644
index 54fa8fcb9..000000000
--- a/MigratedBookSleeveTestSuite/Issues/SO10504853.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-using System;
-using System.Diagnostics;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests.Issues
-{
- [TestFixture]
- public class SO10504853
- {
- [Test]
- public void LoopLotsOfTrivialStuff()
- {
- Trace.WriteLine("### init");
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(0);
- conn.KeyDelete("lots-trivial");
- }
- const int COUNT = 2;
- for (int i = 0; i < COUNT; i++)
- {
- Trace.WriteLine("### incr:" + i);
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(0);
- Assert.AreEqual(i + 1, conn.StringIncrement("lots-trivial"));
- }
- }
- Trace.WriteLine("### close");
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(0);
- Assert.AreEqual(COUNT, (long)conn.StringGet("lots-trivial"));
- }
- }
- [Test]
- public void ExecuteWithEmptyStartingPoint()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(0);
- var task = new { priority = 3 };
- conn.KeyDeleteAsync("item:1");
- conn.HashSetAsync("item:1", "something else", "abc");
- conn.HashSetAsync("item:1", "priority", task.priority.ToString());
-
- var taskResult = conn.HashGetAsync("item:1", "priority");
-
- conn.Wait(taskResult);
-
- var priority = Int32.Parse(taskResult.Result);
-
- Assert.AreEqual(3, priority);
- }
- }
-
- [Test]
- public void ExecuteWithNonHashStartingPoint()
- {
- Assert.Throws(() =>
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(0);
- var task = new { priority = 3 };
- conn.KeyDeleteAsync("item:1");
- conn.StringSetAsync("item:1", "not a hash");
- conn.HashSetAsync("item:1", "priority", task.priority.ToString());
-
- var taskResult = conn.HashGetAsync("item:1", "priority");
-
- try
- {
- conn.Wait(taskResult);
- Assert.Fail();
- }
- catch (AggregateException ex)
- {
- throw ex.InnerExceptions[0];
- }
- }
- },
- message: "WRONGTYPE Operation against a key holding the wrong kind of value");
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Issues/SO10825542.cs b/MigratedBookSleeveTestSuite/Issues/SO10825542.cs
deleted file mode 100644
index 11636652e..000000000
--- a/MigratedBookSleeveTestSuite/Issues/SO10825542.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Text;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests.Issues
-{
- [TestFixture]
- public class SO10825542
- {
- [Test]
- public void Execute()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var key = "somekey1";
-
- var con = muxer.GetDatabase(1);
- // set the field value and expiration
- con.HashSetAsync(key, "field1", Encoding.UTF8.GetBytes("hello world"));
- con.KeyExpireAsync(key, TimeSpan.FromSeconds(7200));
- con.HashSetAsync(key, "field2", "fooobar");
- var task = con.HashGetAllAsync(key);
- con.Wait(task);
-
- Assert.AreEqual(2, task.Result.Length);
- var dict = task.Result.ToStringDictionary();
- Assert.AreEqual("hello world", dict["field1"]);
- Assert.AreEqual("fooobar", dict["field2"]);
- }
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Issues/SO11766033.cs b/MigratedBookSleeveTestSuite/Issues/SO11766033.cs
deleted file mode 100644
index f3fa1cc9e..000000000
--- a/MigratedBookSleeveTestSuite/Issues/SO11766033.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using NUnit.Framework;
-
-namespace Tests.Issues
-{
- [TestFixture]
- public class SO11766033
- {
- [Test]
- public void TestNullString()
- {
- const int db = 3;
- using (var muxer = Config.GetUnsecuredConnection(true))
- {
- var redis = muxer.GetDatabase(db);
- string expectedTestValue = null;
- var uid = Config.CreateUniqueName();
- redis.StringSetAsync(uid, "abc");
- redis.StringSetAsync(uid, expectedTestValue);
- string testValue = redis.StringGet(uid);
- Assert.IsNull(testValue);
- }
- }
-
- [Test]
- public void TestEmptyString()
- {
- const int db = 3;
- using (var muxer = Config.GetUnsecuredConnection(true))
- {
- var redis = muxer.GetDatabase(db);
- string expectedTestValue = "";
- var uid = Config.CreateUniqueName();
-
- redis.StringSetAsync(uid, expectedTestValue);
- string testValue = redis.StringGet(uid);
-
- Assert.AreEqual(expectedTestValue, testValue);
- }
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Keys.cs b/MigratedBookSleeveTestSuite/Keys.cs
deleted file mode 100644
index aa678b4d3..000000000
--- a/MigratedBookSleeveTestSuite/Keys.cs
+++ /dev/null
@@ -1,511 +0,0 @@
-//using System.Threading;
-//using BookSleeve;
-//using NUnit.Framework;
-//using System.Text.RegularExpressions;
-//using System.Linq;
-//using System;
-//namespace Tests
-//{
-// [TestFixture]
-// public class Keys // http://redis.io/commands#generic
-// {
-// // note we don't expose EXPIREAT as it raises all sorts of problems with
-// // time synchronisation, UTC vs local, DST, etc; easier for the caller
-// // to use EXPIRE
-
-// [Test]
-// public void TestDeleteValidKey()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.Set(0, "del", "abcdef");
-// var x = conn.Strings.GetString(0, "del");
-// var del = conn.Keys.Remove(0, "del");
-// var y = conn.Strings.GetString(0, "del");
-// conn.WaitAll(x, del, y);
-// Assert.AreEqual("abcdef", x.Result);
-// Assert.IsTrue(del.Result);
-// Assert.AreEqual(null, y.Result);
-// }
-// }
-
-// [Test]
-// public void TestLargeIntegers()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// const long expected = 20L * int.MaxValue;
-// conn.Strings.Set(0, "large-int", expected);
-// var result = conn.Strings.GetInt64(0, "large-int");
-// Assert.AreEqual(expected, conn.Wait(result));
-// }
-// }
-
-// [Test]
-// public void TestDeleteInvalidKey()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.Set(0, "exists", "abcdef");
-// var x = conn.Keys.Remove(0, "exists");
-// var y = conn.Keys.Remove(0, "exists");
-// conn.WaitAll(x, y);
-// Assert.IsTrue(x.Result);
-// Assert.IsFalse(y.Result);
-// }
-// }
-
-// [Test]
-// public void TestDeleteMultiple()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.Set(0, "del", "abcdef");
-// var x = conn.Keys.Remove(0, "del");
-// var y = conn.Keys.Remove(0, "del");
-// conn.WaitAll(x, y);
-// Assert.IsTrue(x.Result);
-// Assert.IsFalse(y.Result);
-// }
-// }
-
-// [Test]
-// public void Scan()
-// {
-// using (var conn = Config.GetUnsecuredConnection(allowAdmin: true, waitForOpen: true))
-// {
-// if (!conn.Features.Scan) Assert.Inconclusive();
-
-// const int DB = 3;
-// conn.Wait(conn.Server.FlushDb(DB));
-// conn.Strings.Set(DB, "foo", "foo");
-// conn.Strings.Set(DB, "bar", "bar");
-// conn.Strings.Set(DB, "blap", "blap");
-
-// var keys = conn.Keys.Scan(DB).ToArray();
-// Array.Sort(keys);
-// Assert.AreEqual(3, keys.Length);
-// Assert.AreEqual("bar", keys[0]);
-// Assert.AreEqual("blap", keys[1]);
-// Assert.AreEqual("foo", keys[2]);
-
-// keys = conn.Keys.Scan(DB, "b*").ToArray();
-// Array.Sort(keys);
-// Assert.AreEqual(2, keys.Length);
-// Assert.AreEqual("bar", keys[0]);
-// Assert.AreEqual("blap", keys[1]);
-
-
-// }
-// }
-
-// [Test]
-// public void TestExpireAgainstInvalidKey()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.Set(0, "delA", "abcdef");
-// conn.Keys.Remove(0, "delB");
-// conn.Strings.Set(0, "delC", "abcdef");
-
-// var del = conn.Keys.Remove(0, new[] {"delA", "delB", "delC"});
-// Assert.AreEqual(2, conn.Wait(del));
-// }
-// }
-
-// [Test]
-// public void TestExists()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.Set(0, "exists", "abcdef");
-// var x = conn.Keys.Exists(0, "exists");
-// conn.Keys.Remove(0, "exists");
-// var y = conn.Keys.Exists(0, "exists");
-// conn.WaitAll(x, y);
-// Assert.IsTrue(x.Result);
-// Assert.IsFalse (y.Result);
-// }
-// }
-
-// [Test]
-// public void TestExpireAgainstValidKey()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.Set(0, "expire", "abcdef");
-// var x = conn.Keys.TimeToLive(0, "expire");
-// var exp1 = conn.Keys.Expire(0, "expire", 100);
-// var y = conn.Keys.TimeToLive(0, "expire");
-// var exp2 = conn.Keys.Expire(0, "expire", 150);
-// var z = conn.Keys.TimeToLive(0, "expire");
-
-// conn.WaitAll(x, exp1, y, exp2, z);
-
-// Assert.AreEqual(-1, x.Result);
-// Assert.IsTrue(exp1.Result);
-// Assert.GreaterOrEqual(y.Result, 90);
-// Assert.LessOrEqual(y.Result, 100);
-
-// if (conn.Features.ExpireOverwrite)
-// {
-// Assert.IsTrue(exp2.Result);
-// Assert.GreaterOrEqual(z.Result, 140);
-// Assert.LessOrEqual(z.Result, 150);
-// }
-// else
-// {
-// Assert.IsFalse(exp2.Result);
-// Assert.GreaterOrEqual(z.Result, 90);
-// Assert.LessOrEqual(z.Result, 100);
-// }
-// }
-// }
-
-// [Test]
-// public void TestSuccessfulMove()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.Set(1, "move", "move-value");
-// conn.Keys.Remove(2, "move");
-
-// var succ = conn.Keys.Move(1, "move", 2);
-// var in1 = conn.Strings.GetString(1, "move");
-// var in2 = conn.Strings.GetString(2, "move");
-
-// Assert.IsTrue(conn.Wait(succ));
-// Assert.IsNull(conn.Wait(in1));
-// Assert.AreEqual("move-value", conn.Wait(in2));
-// }
-// }
-
-// [Test]
-// public void TestFailedMoveWhenNotExistsInSource()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "move");
-// conn.Strings.Set(2, "move", "move-value");
-
-// var succ = conn.Keys.Move(1, "move", 2);
-// var in1 = conn.Strings.GetString(1, "move");
-// var in2 = conn.Strings.GetString(2, "move");
-
-// Assert.IsFalse(conn.Wait(succ));
-// Assert.IsNull(conn.Wait(in1));
-// Assert.AreEqual("move-value", conn.Wait(in2));
-// }
-// }
-
-// [Test]
-// public void TestFailedMoveWhenNotExistsInTarget()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Strings.Set(1, "move", "move-valueA");
-// conn.Strings.Set(2, "move", "move-valueB");
-
-// var succ = conn.Keys.Move(1, "move", 2);
-// var in1 = conn.Strings.GetString(1, "move");
-// var in2 = conn.Strings.GetString(2, "move");
-
-// Assert.IsFalse(conn.Wait(succ));
-// Assert.AreEqual("move-valueA", conn.Wait(in1));
-// Assert.AreEqual("move-valueB", conn.Wait(in2));
-// }
-// }
-
-// [Test]
-// public void RemoveExpiry()
-// {
-// int errors = 0, expectedErrors;
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// conn.Error += delegate
-// {
-// Interlocked.Increment(ref errors);
-// };
-// conn.Keys.Remove(1, "persist");
-// conn.Strings.Set(1, "persist", "persist");
-// var persist1 = conn.Keys.Persist(1, "persist");
-// conn.Keys.Expire(1, "persist", 100);
-// var before = conn.Keys.TimeToLive(1, "persist");
-// var persist2 = conn.Keys.Persist(1, "persist");
-// var after = conn.Keys.TimeToLive(1, "persist");
-
-// Assert.GreaterOrEqual(conn.Wait(before), 90);
-// if (conn.Features.Persist)
-// {
-// Assert.IsFalse(conn.Wait(persist1));
-// Assert.IsTrue(conn.Wait(persist2));
-// Assert.AreEqual(-1, conn.Wait(after));
-// expectedErrors = 0;
-// }
-// else
-// {
-// try{
-// conn.Wait(persist1);
-// Assert.Fail();
-// }
-// catch (RedisException){}
-// try
-// {
-// conn.Wait(persist2);
-// Assert.Fail();
-// }
-// catch (RedisException) { }
-// Assert.GreaterOrEqual(conn.Wait(after), 90);
-// expectedErrors = 2;
-// }
-// }
-
-// Assert.AreEqual(expectedErrors, Interlocked.CompareExchange(ref errors,0,0));
-// }
-
-
-// [Test]
-// public void RandomKeys()
-// {
-// using (var conn = Config.GetUnsecuredConnection(allowAdmin: true, waitForOpen: true))
-// {
-// conn.Server.FlushDb(6);
-// var key1 = conn.Keys.Random(6);
-// conn.Strings.Set(6, "random1", "random1");
-// var key2 = conn.Keys.Random(6);
-// for (int i = 2; i < 100; i++)
-// {
-// string key = "random" + i;
-// conn.Strings.Set(6, key, key);
-// }
-// var key3 = conn.Keys.Random(6);
-
-// Assert.IsNull(conn.Wait(key1));
-// Assert.AreEqual("random1", conn.Wait(key2));
-// string s = conn.Wait(key3);
-
-// Assert.IsTrue(s.StartsWith("random"));
-// s = s.Substring(6);
-// int result = int.Parse(s);
-// Assert.GreaterOrEqual(result, 1);
-// Assert.Less(result, 100);
-// }
-
-// }
-
-// [Test]
-// public void Sort()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "sort");
-// conn.Lists.AddLast(1, "sort", "10");
-// conn.Lists.AddLast(1, "sort", "3");
-// conn.Lists.AddLast(1, "sort", "1.1");
-// conn.Lists.AddLast(1, "sort", "2");
-// var a = conn.Keys.SortString(1, "sort");
-// var b = conn.Keys.SortString(1, "sort", ascending: false, offset: 1, count: 2);
-// var c = conn.Keys.SortString(1, "sort", alpha: true);
-// var d = conn.Keys.SortAndStore(1, "sort-store", "sort");
-// var e = conn.Lists.RangeString(1, "sort-store", 0, -1);
-// var f = conn.Lists.RangeString(1, "sort", 0, -1);
-
-// Assert.AreEqual("1.1;2;3;10",string.Join(";", conn.Wait(a)));
-// Assert.AreEqual("3;2",string.Join(";", conn.Wait(b)));
-// Assert.AreEqual("10;1.1;2;3", string.Join(";", conn.Wait(c)));
-// Assert.AreEqual(4, conn.Wait(d));
-// Assert.AreEqual("1.1;2;3;10", string.Join(";", conn.Wait(e)));
-// Assert.AreEqual("10;3;1.1;2", string.Join(";", conn.Wait(f)));
-
-// }
-
-// }
-
-// [Test]
-// public void ItemType()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(4, new[]{"type-none", "type-list", "type-string",
-// "type-set", "type-zset", "type-hash"});
-// conn.Strings.Set(4, "type-string", "blah");
-// conn.Lists.AddLast(4, "type-list", "blah");
-// conn.Sets.Add(4, "type-set", "blah");
-// conn.SortedSets.Add(4, "type-zset", "blah", 123);
-// conn.Hashes.Set(4, "type-hash", "foo", "blah");
-
-// var x0 = conn.Keys.Type(4, "type-none");
-// var x1 = conn.Keys.Type(4, "type-list");
-// var x2 = conn.Keys.Type(4, "type-string");
-// var x3 = conn.Keys.Type(4, "type-set");
-// var x4 = conn.Keys.Type(4, "type-zset");
-// var x5 = conn.Keys.Type(4, "type-hash");
-
-// Assert.AreEqual(RedisConnection.ItemTypes.None, conn.Wait(x0));
-// Assert.AreEqual(RedisConnection.ItemTypes.List, conn.Wait(x1));
-// Assert.AreEqual(RedisConnection.ItemTypes.String, conn.Wait(x2));
-// Assert.AreEqual(RedisConnection.ItemTypes.Set, conn.Wait(x3));
-// Assert.AreEqual(RedisConnection.ItemTypes.SortedSet, conn.Wait(x4));
-// Assert.AreEqual(RedisConnection.ItemTypes.Hash, conn.Wait(x5));
-// }
-// }
-// [Test]
-// public void RenameKeyWithOverwrite()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "foo");
-// conn.Keys.Remove(1, "bar");
-
-// var check1 = conn.Keys.Rename(1, "foo", "bar"); // neither
-// var after1_foo = conn.Strings.GetString(1, "foo");
-// var after1_bar = conn.Strings.GetString(1, "bar");
-
-// conn.Strings.Set(1, "foo", "foo-value");
-
-// var check2 = conn.Keys.Rename(1, "foo", "bar"); // source only
-// var after2_foo = conn.Strings.GetString(1, "foo");
-// var after2_bar = conn.Strings.GetString(1, "bar");
-
-// var check3 = conn.Keys.Rename(1, "foo", "bar"); // dest only
-// var after3_foo = conn.Strings.GetString(1, "foo");
-// var after3_bar = conn.Strings.GetString(1, "bar");
-
-// conn.Strings.Set(1, "foo", "new-value");
-// var check4 = conn.Keys.Rename(1, "foo", "bar"); // both
-// var after4_foo = conn.Strings.GetString(1, "foo");
-// var after4_bar = conn.Strings.GetString(1, "bar");
-
-// try
-// {
-// conn.Wait(check1);
-// Assert.Fail();
-// }
-// catch (RedisException) { }
-// Assert.IsNull(conn.Wait(after1_foo));
-// Assert.IsNull(conn.Wait(after1_bar));
-
-// conn.Wait(check2);
-// Assert.IsNull(conn.Wait(after2_foo));
-// Assert.AreEqual("foo-value", conn.Wait(after2_bar));
-
-// try
-// {
-// conn.Wait(check3);
-// Assert.Fail();
-// }
-// catch (RedisException) { }
-// Assert.IsNull(conn.Wait(after3_foo));
-// Assert.AreEqual("foo-value", conn.Wait(after3_bar));
-
-// conn.Wait(check4);
-// Assert.IsNull(conn.Wait(after4_foo));
-// Assert.AreEqual("new-value", conn.Wait(after4_bar));
-
-// }
-// }
-
-// [Test]
-// public void RenameKeyWithoutOverwrite()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "foo");
-// conn.Keys.Remove(1, "bar");
-
-// var check1 = conn.Keys.RenameIfNotExists(1, "foo", "bar"); // neither
-// var after1_foo = conn.Strings.GetString(1, "foo");
-// var after1_bar = conn.Strings.GetString(1, "bar");
-
-// conn.Strings.Set(1, "foo", "foo-value");
-
-// var check2 = conn.Keys.RenameIfNotExists(1, "foo", "bar"); // source only
-// var after2_foo = conn.Strings.GetString(1, "foo");
-// var after2_bar = conn.Strings.GetString(1, "bar");
-
-// var check3 = conn.Keys.RenameIfNotExists(1, "foo", "bar"); // dest only
-// var after3_foo = conn.Strings.GetString(1, "foo");
-// var after3_bar = conn.Strings.GetString(1, "bar");
-
-// conn.Strings.Set(1, "foo", "new-value");
-// var check4 = conn.Keys.RenameIfNotExists(1, "foo", "bar"); // both
-// var after4_foo = conn.Strings.GetString(1, "foo");
-// var after4_bar = conn.Strings.GetString(1, "bar");
-
-// try
-// {
-// conn.Wait(check1);
-// Assert.Fail();
-// }
-// catch (RedisException) { }
-// Assert.IsNull(conn.Wait(after1_foo));
-// Assert.IsNull(conn.Wait(after1_bar));
-
-// Assert.IsTrue(conn.Wait(check2));
-// Assert.IsNull(conn.Wait(after2_foo));
-// Assert.AreEqual("foo-value", conn.Wait(after2_bar));
-
-// try
-// {
-// conn.Wait(check3);
-// Assert.Fail();
-// }
-// catch (RedisException) { }
-// Assert.IsNull(conn.Wait(after3_foo));
-// Assert.AreEqual("foo-value", conn.Wait(after3_bar));
-
-// Assert.IsFalse(conn.Wait(check4));
-// Assert.AreEqual("new-value", conn.Wait(after4_foo));
-// Assert.AreEqual("foo-value", conn.Wait(after4_bar));
-
-// }
-// }
-
-// [Test]
-// public void TestFind()
-// {
-// using(var conn = Config.GetUnsecuredConnection(allowAdmin:true))
-// {
-// conn.Server.FlushDb(5);
-// conn.Strings.Set(5, "abc", "def");
-// conn.Strings.Set(5, "abd", "ghi");
-// conn.Strings.Set(5, "aef", "jkl");
-// var arr = conn.Wait(conn.Keys.Find(5, "ab*"));
-// Assert.AreEqual(2, arr.Length);
-// Assert.Contains("abc", arr);
-// Assert.Contains("abd", arr);
-// }
-// }
-
-// [Test]
-// public void TestDBSize()
-// {
-// using(var conn = Config.GetUnsecuredConnection(allowAdmin:true))
-// {
-// conn.Server.FlushDb(5);
-// var empty = conn.Keys.GetLength(5);
-// for (int i = 0; i < 10; i++ )
-// conn.Strings.Set(5, "abc" + i, "def" + i);
-// var withData = conn.Keys.GetLength(5);
-
-// Assert.AreEqual(0, conn.Wait(empty));
-// Assert.AreEqual(10, conn.Wait(withData));
-// }
-// }
-
-// [Test]
-// public void TestDebugObject()
-// {
-// using (var conn = Config.GetUnsecuredConnection(allowAdmin: true))
-// {
-// conn.Strings.Set(3, "test-debug", "some value");
-// var s = conn.Wait(conn.Keys.DebugObject(3, "test-debug"));
-// Assert.IsTrue(Regex.IsMatch(s, @"\bserializedlength:([0-9]+)\b"));
-// }
-// }
-// }
-//}
-
-
-
-
diff --git a/MigratedBookSleeveTestSuite/Lists.cs b/MigratedBookSleeveTestSuite/Lists.cs
deleted file mode 100644
index 8e1de87fb..000000000
--- a/MigratedBookSleeveTestSuite/Lists.cs
+++ /dev/null
@@ -1,713 +0,0 @@
-//using System.Text;
-//using NUnit.Framework;
-//using System.Linq;
-//using System;
-//using System.Threading;
-//namespace Tests
-//{
-// [TestFixture]
-// public class Lists // http://redis.io/commands#list
-// {
-// [Test]
-// public void CheckLengthWhenEmpty()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(4, "mylist");
-// var len = conn.Lists.GetLength(4, "mylist");
-
-// Assert.AreEqual(0, conn.Wait(len));
-// }
-// }
-
-// [Test]
-// public void CheckLengthWithContents()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(4, "mylist");
-// for (int i = 0; i < 100; i++)
-// conn.Lists.AddLast(4, "mylist", new[] { (byte)i });
-// var len = conn.Lists.GetLength(4, "mylist");
-
-// Assert.AreEqual(100, conn.Wait(len));
-// }
-// }
-
-// static byte[] Encode(string value) { return Encoding.UTF8.GetBytes(value); }
-// static string Decode(byte[] value) { return Encoding.UTF8.GetString(value); }
-// [Test]
-// public void CheckRightPush()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// conn.Keys.Remove(4, "mylist");
-// var lenNil = conn.Features.PushIfNotExists ? conn.Lists.AddLast(4, "mylist", Encode("value1"), createIfMissing: false) : null;
-// var len1 = conn.Lists.AddLast(4, "mylist", Encode("value1"));
-// var len2 = conn.Lists.AddLast(4, "mylist", Encode("value2"));
-// var items = conn.Lists.Range(4, "mylist", 0, -1);
-
-// if (lenNil != null) Assert.AreEqual(0, conn.Wait(lenNil));
-// Assert.AreEqual(1, conn.Wait(len1));
-// Assert.AreEqual(2, conn.Wait(len2));
-// var arr = conn.Wait(items);
-// Assert.AreEqual(2, arr.Length);
-// Assert.AreEqual("value1", Decode(arr[0]));
-// Assert.AreEqual("value2", Decode(arr[1]));
-// }
-// }
-// [Test]
-// public void CheckLeftPush()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// conn.Keys.Remove(4, "mylist");
-// var lenNil = conn.Features.PushIfNotExists ? conn.Lists.AddLast(4, "mylist", Encode("value1"), createIfMissing: false) : null;
-// var len1 = conn.Lists.AddFirst(4, "mylist", Encode("value1"));
-// var len2 = conn.Lists.AddFirst(4, "mylist", Encode("value2"));
-// var items = conn.Lists.Range(4, "mylist", 0, -1);
-
-// if(lenNil != null) Assert.AreEqual(0, conn.Wait(lenNil));
-// Assert.AreEqual(1, conn.Wait(len1));
-// Assert.AreEqual(2, conn.Wait(len2));
-// var arr = conn.Wait(items);
-// Assert.AreEqual(2, arr.Length);
-// Assert.AreEqual("value2", Decode(arr[0]));
-// Assert.AreEqual("value1", Decode(arr[1]));
-// }
-// }
-// [Test]
-// public void CheckLeftPop()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(4, "mylist");
-// conn.Lists.AddLast(4, "mylist", Encode("value1"));
-// conn.Lists.AddLast(4, "mylist", Encode("value2"));
-
-// var first = conn.Lists.RemoveFirst(4, "mylist");
-// var second = conn.Lists.RemoveFirstString(4, "mylist");
-// var third = conn.Lists.RemoveFirst(4, "mylist");
-// var len = conn.Lists.GetLength(4, "mylist");
-
-// Assert.AreEqual("value1", Decode(conn.Wait(first)));
-// Assert.AreEqual("value2", conn.Wait(second));
-// Assert.IsNull(conn.Wait(third));
-// Assert.AreEqual(0, conn.Wait(len));
-// }
-// }
-// [Test]
-// public void CheckRightPop()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(4, "mylist");
-// conn.Lists.AddLast(4, "mylist", Encode("value1"));
-// conn.Lists.AddLast(4, "mylist", Encode("value2"));
-
-// var first = conn.Lists.RemoveLast(4, "mylist");
-// var second = conn.Lists.RemoveLastString(4, "mylist");
-// var third = conn.Lists.RemoveLast(4, "mylist");
-// var len = conn.Lists.GetLength(4, "mylist");
-
-// Assert.AreEqual("value2", Decode(conn.Wait(first)));
-// Assert.AreEqual("value1", conn.Wait(second));
-// Assert.IsNull(conn.Wait(third));
-// Assert.AreEqual(0, conn.Wait(len));
-// }
-// }
-
-
-// [Test]
-// public void CheckPushPop()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(4, "source");
-// conn.Keys.Remove(4, "dest");
-
-// var empty0 = conn.Lists.RemoveLastAndAddFirst(4, "source", "dest");
-// var empty1 = conn.Lists.RemoveLastAndAddFirstString(4, "source", "dest");
-// conn.Lists.AddLast(4, "source", "abc");
-// conn.Lists.AddLast(4, "source", "def");
-
-// var s = conn.Lists.RemoveLastAndAddFirstString(4, "source", "dest");
-// var b = conn.Lists.RemoveLastAndAddFirst(4, "source", "dest");
-// var l0 = conn.Lists.GetLength(4, "source");
-// var l1 = conn.Lists.GetLength(4, "dest");
-// var final = conn.Lists.RangeString(4, "dest", 0, 3);
-
-// Assert.IsNull(conn.Wait(empty0));
-// Assert.IsNull(conn.Wait(empty1));
-// Assert.AreEqual("def", conn.Wait(s));
-// Assert.AreEqual("abc", Decode(conn.Wait(b)));
-// Assert.AreEqual(0, conn.Wait(l0));
-// Assert.AreEqual(2, conn.Wait(l1));
-
-// var arr = conn.Wait(final);
-// Assert.AreEqual(2, arr.Length);
-// Assert.AreEqual("abc", arr[0]);
-// Assert.AreEqual("def", arr[1]);
-
-
-// }
-// }
-
-
-
-// [Test]
-// public void GetStringFromList()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(4, "mylist");
-// var missing = conn.Lists.GetString(4, "mylist", 0);
-
-// conn.Lists.AddLast(4, "mylist", "abc");
-// conn.Lists.AddLast(4, "mylist", "def");
-// conn.Lists.AddLast(4, "mylist", "ghi");
-
-// var x0 = conn.Lists.GetString(4, "mylist", 0);
-// var x1 = conn.Lists.GetString(4, "mylist", 1);
-// var x2 = conn.Lists.GetString(4, "mylist", 2);
-// var x3 = conn.Lists.GetString(4, "mylist", 3);
-
-// var m1 = conn.Lists.GetString(4, "mylist", -1);
-// var m2 = conn.Lists.GetString(4, "mylist", -2);
-// var m3 = conn.Lists.GetString(4, "mylist", -3);
-// var m4 = conn.Lists.GetString(4, "mylist", -4);
-
-// Assert.IsNull(conn.Wait(missing));
-
-// Assert.AreEqual("abc", conn.Wait(x0));
-// Assert.AreEqual("def", conn.Wait(x1));
-// Assert.AreEqual("ghi", conn.Wait(x2));
-// Assert.IsNull(conn.Wait(x3));
-
-// Assert.AreEqual("ghi", conn.Wait(m1));
-// Assert.AreEqual("def", conn.Wait(m2));
-// Assert.AreEqual("abc", conn.Wait(m3));
-// Assert.IsNull(conn.Wait(m4));
-
-// }
-// }
-
-// [Test]
-// public void GetBytesFromList()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(4, "mylist");
-// var missing = conn.Lists.GetString(4, "mylist", 0);
-
-// conn.Lists.AddLast(4, "mylist", Encode("abc"));
-// conn.Lists.AddLast(4, "mylist", Encode("def"));
-// conn.Lists.AddLast(4, "mylist", Encode("ghi"));
-
-// var x0 = conn.Lists.Get(4, "mylist", 0);
-// var x1 = conn.Lists.Get(4, "mylist", 1);
-// var x2 = conn.Lists.Get(4, "mylist", 2);
-// var x3 = conn.Lists.Get(4, "mylist", 3);
-
-// var m1 = conn.Lists.Get(4, "mylist", -1);
-// var m2 = conn.Lists.Get(4, "mylist", -2);
-// var m3 = conn.Lists.Get(4, "mylist", -3);
-// var m4 = conn.Lists.Get(4, "mylist", -4);
-
-// Assert.IsNull(conn.Wait(missing));
-
-// Assert.AreEqual("abc", Decode(conn.Wait(x0)));
-// Assert.AreEqual("def", Decode(conn.Wait(x1)));
-// Assert.AreEqual("ghi", Decode(conn.Wait(x2)));
-// Assert.IsNull(conn.Wait(x3));
-
-// Assert.AreEqual("ghi", Decode(conn.Wait(m1)));
-// Assert.AreEqual("def", Decode(conn.Wait(m2)));
-// Assert.AreEqual("abc", Decode(conn.Wait(m3)));
-// Assert.IsNull(conn.Wait(m4));
-
-// }
-// }
-
-// [Test]
-// public void TestListInsertString()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen:true))
-// {
-// if (conn.Features.ListInsert)
-// {
-// conn.Keys.Remove(2, "ins");
-// conn.Lists.AddFirst(2, "ins", "x");
-// var missingB = conn.Lists.InsertBefore(2, "ins", "abc", "AAA");
-// var missingA = conn.Lists.InsertAfter(2, "ins", "abc", "BBB");
-
-// conn.Lists.AddFirst(2, "ins", "abc");
-// conn.Lists.AddFirst(2, "ins", "y");
-// var existB = conn.Lists.InsertBefore(2, "ins", "abc", "CCC");
-// var existA = conn.Lists.InsertAfter(2, "ins", "abc", "DDD");
-// var all = conn.Lists.RangeString(2, "ins", 0, -1);
-// Assert.AreEqual(-1, conn.Wait(missingB));
-// Assert.AreEqual(-1, conn.Wait(missingA));
-
-// Assert.AreEqual(4, conn.Wait(existB));
-// Assert.AreEqual(5, conn.Wait(existA));
-
-// string seq = string.Join(" ", conn.Wait(all));
-// Assert.AreEqual("y CCC abc DDD x", seq);
-// }
-// }
-// }
-// [Test]
-// public void TestListInsertBlob()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen:true))
-// {
-// if (conn.Features.ListInsert)
-// {
-// conn.Keys.Remove(2, "ins");
-// conn.Lists.AddFirst(2, "ins", Encode("x"));
-// var missingB = conn.Lists.InsertBefore(2, "ins", Encode("abc"), Encode("AAA"));
-// var missingA = conn.Lists.InsertAfter(2, "ins", Encode("abc"), Encode("BBB"));
-
-// conn.Lists.AddFirst(2, "ins", Encode("abc"));
-// conn.Lists.AddFirst(2, "ins", Encode("y"));
-// var existB = conn.Lists.InsertBefore(2, "ins", Encode("abc"), Encode("CCC"));
-// var existA = conn.Lists.InsertAfter(2, "ins", Encode("abc"), Encode("DDD"));
-// var all = conn.Lists.Range(2, "ins", 0, -1);
-// Assert.AreEqual(-1, conn.Wait(missingB));
-// Assert.AreEqual(-1, conn.Wait(missingA));
-
-// Assert.AreEqual(4, conn.Wait(existB));
-// Assert.AreEqual(5, conn.Wait(existA));
-// string seq = string.Join(" ", conn.Wait(all).Select(Decode));
-// Assert.AreEqual("y CCC abc DDD x", seq);
-// }
-// }
-// }
-// [Test]
-// public void TestListByIndexString()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(2, "byindex");
-// var notExists = conn.Lists.GetString(2, "byindex", 1);
-// conn.Lists.AddLast(2, "byindex", "a");
-// conn.Lists.AddLast(2, "byindex", "b");
-// conn.Lists.AddLast(2, "byindex", "c");
-
-// var item = conn.Lists.GetString(2, "byindex", 1);
-// var outOfRange = conn.Lists.GetString(3, "byindex", 1);
-// Assert.IsNull(conn.Wait(notExists));
-// Assert.AreEqual("b", conn.Wait(item));
-// Assert.IsNull(conn.Wait(outOfRange));
-// }
-// }
-// [Test]
-// public void TestListByIndexBlob()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(2, "byindex");
-// var notExists = conn.Lists.Get(2, "byindex", 1);
-// conn.Lists.AddLast(2, "byindex", Encode("a"));
-// conn.Lists.AddLast(2, "byindex", Encode("b"));
-// conn.Lists.AddLast(2, "byindex", Encode("c"));
-
-// var item = conn.Lists.Get(2, "byindex", 1);
-// var outOfRange = conn.Lists.Get(3, "byindex", 1);
-// Assert.IsNull(conn.Wait(notExists));
-// Assert.AreEqual("b", Decode(conn.Wait(item)));
-// Assert.IsNull(conn.Wait(outOfRange));
-// }
-// }
-// [Test]
-// public void TestTrim()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(2, "trim");
-
-// conn.Lists.Trim(2, "trim", 1);
-// var ne = conn.Lists.GetLength(2, "trim");
-
-// conn.Lists.AddLast(2, "trim", Encode("a"));
-// conn.Lists.AddLast(2, "trim", Encode("b"));
-// conn.Lists.AddLast(2, "trim", Encode("c"));
-
-
-// conn.Lists.Trim(2, "trim", 1);
-// var e = conn.Lists.GetLength(2, "trim");
-
-// Assert.AreEqual(0, conn.Wait(ne));
-// Assert.AreEqual(1, conn.Wait(e));
-// }
-// }
-// [Test]
-// public void TestSetByIndexString()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(2, "setbyindex");
-
-// conn.Lists.AddLast(2, "setbyindex", "a");
-// conn.Lists.AddLast(2, "setbyindex", "b");
-// conn.Lists.AddLast(2, "setbyindex", "c");
-
-// conn.Lists.Set(2, "setbyindex", 1, "d");
-// var item = conn.Lists.GetString(2, "setbyindex", 1);
-
-// Assert.AreEqual("d", conn.Wait(item));
-// }
-// }
-// [Test]
-// public void TestSetByIndexBlob()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(2, "setbyindex");
-
-// conn.Lists.AddLast(2, "setbyindex", Encode("a"));
-// conn.Lists.AddLast(2, "setbyindex", Encode("b"));
-// conn.Lists.AddLast(2, "setbyindex", Encode("c"));
-
-// conn.Lists.Set(2, "setbyindex", 1, Encode("d"));
-// var item = conn.Lists.Get(2, "setbyindex", 1);
-
-// Assert.AreEqual("d", Decode(conn.Wait(item)));
-// }
-// }
-// [Test]
-// public void TestRemoveString()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(2, "remove");
-// var ne = conn.Lists.Remove(2, "remove", "b");
-
-// conn.Lists.AddLast(2, "remove", "b");
-// conn.Lists.AddLast(2, "remove", "a");
-// conn.Lists.AddLast(2, "remove", "b");
-// conn.Lists.AddLast(2, "remove", "c");
-// conn.Lists.AddLast(2, "remove", "b");
-
-// var e = conn.Lists.Remove(2, "remove", "b", count: 2);
-// var count = conn.Lists.GetLength(2, "remove");
-// Assert.AreEqual(0, conn.Wait(ne));
-// Assert.AreEqual(2, conn.Wait(e));
-// Assert.AreEqual(3, conn.Wait(count));
-// }
-// }
-// [Test]
-// public void TestRemoveBlob()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(2, "remove");
-// var ne = conn.Lists.Remove(2, "remove", Encode("b"));
-
-// conn.Lists.AddLast(2, "remove", Encode("b"));
-// conn.Lists.AddLast(2, "remove", Encode("a"));
-// conn.Lists.AddLast(2, "remove", Encode("b"));
-// conn.Lists.AddLast(2, "remove", Encode("c"));
-// conn.Lists.AddLast(2, "remove", Encode("b"));
-
-// var e = conn.Lists.Remove(2, "remove", Encode("b"), count: 2);
-// var count = conn.Lists.GetLength(2, "remove");
-// Assert.AreEqual(0, conn.Wait(ne));
-// Assert.AreEqual(2, conn.Wait(e));
-// Assert.AreEqual(3, conn.Wait(count));
-// }
-// }
-
-// [Test, ExpectedException(typeof(ArgumentOutOfRangeException))]
-// public void TestTrimNeg()
-// {
-// using(var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "trim");
-// conn.Lists.AddLast(1, "trim", "x");
-// conn.Lists.AddLast(1, "trim", "x");
-// conn.Lists.Trim(1, "trim", -1);
-// }
-// }
-// [Test]
-// public void TestTrimZero()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "trim");
-// conn.Lists.AddLast(1, "trim", "x");
-// conn.Lists.AddLast(1, "trim", "x");
-// conn.Lists.Trim(1, "trim", 0);
-// Assert.IsFalse(conn.Wait(conn.Keys.Exists(1, "trim")));
-// Assert.AreEqual(0, conn.Wait(conn.Lists.GetLength(1, "trim")));
-// }
-// }
-// [Test]
-// public void TestTrimOne()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "trim");
-// conn.Lists.AddLast(1, "trim", "x");
-// conn.Lists.AddLast(1, "trim", "x");
-// conn.Lists.Trim(1, "trim", 1);
-// Assert.IsTrue(conn.Wait(conn.Keys.Exists(1, "trim")));
-// Assert.AreEqual(1, conn.Wait(conn.Lists.GetLength(1, "trim")));
-// }
-// }
-
-// [Test, ExpectedException(typeof(TimeoutException), ExpectedMessage = "The operation has timed out; possibly blocked by: 1: BLPOP \"blocking\" 5")]
-// public void TestBlockingTimeout()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "blocking");
-// conn.Lists.BlockingRemoveFirst(1, new[]{"blocking"}, 5);
-// var next = conn.Strings.Get(1, "foofoo");
-// conn.Wait(next);
-// }
-// }
-
-// [Test]
-// public void TestLeftBlockingPop()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// using (var conn2 = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "blocking");
-// conn.Keys.Remove(1, "blocking-A");
-// conn.Keys.Remove(1, "blocking-B");
-// // empty, no data
-// Assert.IsNull(conn.Lists.BlockingRemoveFirstString(1, new[] { "blocking" }, 1).Result);
-
-// // empty, successful blocking getting data from another client
-// var found = conn.Lists.BlockingRemoveFirstString(1, new[] { "blocking" }, 1);
-// var len = conn2.Lists.AddLast(1, "blocking", "another client");
-// Assert.AreEqual("blocking", conn.Wait(found).Item1);
-// Assert.AreEqual("another client", conn.Wait(found).Item2);
-// Assert.AreEqual(1, conn2.Wait(len));
-
-// // empty, successful blocking getting data from another client, multiple keys
-// found = conn.Lists.BlockingRemoveFirstString(1, new[] { "blocking-A", "blocking", "blocking-B" }, 1);
-// len = conn2.Lists.AddLast(1, "blocking", "another client");
-// Assert.AreEqual("blocking", conn.Wait(found).Item1);
-// Assert.AreEqual("another client", conn.Wait(found).Item2);
-// Assert.AreEqual(1, conn2.Wait(len));
-
-// // data, no need to block
-// conn.Lists.AddLast(1, "blocking", "abc");
-// len = conn.Lists.AddLast(1, "blocking", "def");
-// var found0 = conn.Lists.BlockingRemoveFirstString(1, new[] { "blocking" }, 1);
-// var found1 = conn.Lists.BlockingRemoveFirstString(1, new[] { "blocking" }, 1);
-// var found2 = conn.Lists.BlockingRemoveFirstString(1, new[] { "blocking" }, 1);
-// Assert.AreEqual(2, conn.Wait(len));
-// Assert.AreEqual("blocking", conn.Wait(found0).Item1);
-// Assert.AreEqual("abc", conn.Wait(found0).Item2);
-// Assert.AreEqual("blocking", conn.Wait(found1).Item1);
-// Assert.AreEqual("def", conn.Wait(found1).Item2);
-// Assert.IsNull(found2.Result);
-// }
-// }
-
-// [Test]
-// public void TestRightBlockingPop()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// using (var conn2 = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "blocking");
-// conn.Keys.Remove(1, "blocking-A");
-// conn.Keys.Remove(1, "blocking-B");
-// // empty, no data
-// Assert.IsNull(conn.Lists.BlockingRemoveLastString(1, new[] { "blocking" }, 1).Result);
-
-// // empty, successful blocking getting data from another client
-// var found = conn.Lists.BlockingRemoveLastString(1, new[] { "blocking" }, 1);
-// var len = conn2.Lists.AddLast(1, "blocking", "another client");
-// Assert.AreEqual("blocking", conn.Wait(found).Item1);
-// Assert.AreEqual("another client", conn.Wait(found).Item2);
-// Assert.AreEqual(1, conn2.Wait(len));
-
-// // empty, successful blocking getting data from another client, multiple keys
-// found = conn.Lists.BlockingRemoveLastString(1, new[] { "blocking-A", "blocking", "blocking-B" }, 1);
-// len = conn2.Lists.AddLast(1, "blocking", "another client");
-// Assert.AreEqual("blocking", conn.Wait(found).Item1);
-// Assert.AreEqual("another client", conn.Wait(found).Item2);
-// Assert.AreEqual(1, conn2.Wait(len));
-
-// // data, no need to block
-// conn.Lists.AddLast(1, "blocking", "abc");
-// len = conn.Lists.AddLast(1, "blocking", "def");
-// var found0 = conn.Lists.BlockingRemoveLastString(1, new[] { "blocking" }, 1);
-// var found1 = conn.Lists.BlockingRemoveLastString(1, new[] { "blocking" }, 1);
-// var found2 = conn.Lists.BlockingRemoveLastString(1, new[] { "blocking" }, 1);
-// Assert.AreEqual(2, conn.Wait(len));
-// Assert.AreEqual("blocking", conn.Wait(found0).Item1);
-// Assert.AreEqual("def", conn.Wait(found0).Item2);
-// Assert.AreEqual("blocking", conn.Wait(found1).Item1);
-// Assert.AreEqual("abc", conn.Wait(found1).Item2);
-// Assert.IsNull(found2.Result);
-// }
-// }
-
-// [Test]
-// public void TestLeftBlockingPopBytes()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// using (var conn2 = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "blocking");
-// conn.Keys.Remove(1, "blocking-A");
-// conn.Keys.Remove(1, "blocking-B");
-// // empty, no data
-// Assert.IsNull(conn.Lists.BlockingRemoveFirst(1, new[] { "blocking" }, 1).Result);
-
-// // empty, successful blocking getting data from another client
-// var found = conn.Lists.BlockingRemoveFirst(1, new[] { "blocking" }, 1);
-// var len = conn2.Lists.AddLast(1, "blocking", "another client");
-// Assert.AreEqual("blocking", conn.Wait(found).Item1);
-// Assert.AreEqual("another client", Encoding.UTF8.GetString(conn.Wait(found).Item2));
-// Assert.AreEqual(1, conn2.Wait(len));
-
-// // empty, successful blocking getting data from another client, multiple keys
-// found = conn.Lists.BlockingRemoveFirst(1, new[] { "blocking-A", "blocking", "blocking-B" }, 1);
-// len = conn2.Lists.AddLast(1, "blocking", "another client");
-// Assert.AreEqual("blocking", conn.Wait(found).Item1);
-// Assert.AreEqual("another client", Encoding.UTF8.GetString(conn.Wait(found).Item2));
-// Assert.AreEqual(1, conn2.Wait(len));
-
-// // data, no need to block
-// conn.Lists.AddLast(1, "blocking", "abc");
-// len = conn.Lists.AddLast(1, "blocking", "def");
-// var found0 = conn.Lists.BlockingRemoveFirst(1, new[] { "blocking" }, 1);
-// var found1 = conn.Lists.BlockingRemoveFirst(1, new[] { "blocking" }, 1);
-// var found2 = conn.Lists.BlockingRemoveFirst(1, new[] { "blocking" }, 1);
-// Assert.AreEqual(2, conn.Wait(len));
-// Assert.AreEqual("blocking", conn.Wait(found0).Item1);
-// Assert.AreEqual("abc", Encoding.UTF8.GetString(conn.Wait(found0).Item2));
-// Assert.AreEqual("blocking", conn.Wait(found1).Item1);
-// Assert.AreEqual("def", Encoding.UTF8.GetString(conn.Wait(found1).Item2));
-// Assert.IsNull(found2.Result);
-// }
-// }
-
-// [Test]
-// public void TestRightBlockingPopBytes()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// using (var conn2 = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "blocking");
-// conn.Keys.Remove(1, "blocking-A");
-// conn.Keys.Remove(1, "blocking-B");
-// // empty, no data
-// Assert.IsNull(conn.Lists.BlockingRemoveLast(1, new[] { "blocking" }, 1).Result);
-
-// // empty, successful blocking getting data from another client
-// var found = conn.Lists.BlockingRemoveLast(1, new[] { "blocking" }, 1);
-// var len = conn2.Lists.AddLast(1, "blocking", "another client");
-// Assert.AreEqual("blocking", conn.Wait(found).Item1);
-// Assert.AreEqual("another client", Encoding.UTF8.GetString(conn.Wait(found).Item2));
-// Assert.AreEqual(1, conn2.Wait(len));
-
-// // empty, successful blocking getting data from another client, multiple keys
-// found = conn.Lists.BlockingRemoveLast(1, new[] { "blocking-A", "blocking", "blocking-B" }, 1);
-// len = conn2.Lists.AddLast(1, "blocking", "another client");
-// Assert.AreEqual("blocking", conn.Wait(found).Item1);
-// Assert.AreEqual("another client", Encoding.UTF8.GetString(conn.Wait(found).Item2));
-// Assert.AreEqual(1, conn2.Wait(len));
-
-// // data, no need to block
-// conn.Lists.AddLast(1, "blocking", "abc");
-// len = conn.Lists.AddLast(1, "blocking", "def");
-// var found0 = conn.Lists.BlockingRemoveLast(1, new[] { "blocking" }, 1);
-// var found1 = conn.Lists.BlockingRemoveLast(1, new[] { "blocking" }, 1);
-// var found2 = conn.Lists.BlockingRemoveLast(1, new[] { "blocking" }, 1);
-// Assert.AreEqual(2, conn.Wait(len));
-// Assert.AreEqual("blocking", conn.Wait(found0).Item1);
-// Assert.AreEqual("def", Encoding.UTF8.GetString(conn.Wait(found0).Item2));
-// Assert.AreEqual("blocking", conn.Wait(found1).Item1);
-// Assert.AreEqual("abc", Encoding.UTF8.GetString(conn.Wait(found1).Item2));
-// Assert.IsNull(found2.Result);
-// }
-// }
-
-// [Test]
-// public void TestBlockingPopPush()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// using (var conn2 = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "source");
-// conn.Keys.Remove(1, "target");
-
-// // empty
-// var found = conn.Lists.BlockingRemoveLastAndAddFirstString(1, "source", "target", 1);
-// Assert.IsNull(found.Result);
-
-// // already data
-// conn.Lists.AddLast(1, "source", "abc");
-// conn.Lists.AddLast(1, "source", "def");
-// var found0 = conn.Lists.BlockingRemoveLastAndAddFirstString(1, "source", "target", 1);
-// var found1 = conn.Lists.BlockingRemoveLastAndAddFirstString(1, "source", "target", 1);
-// var found2 = conn.Lists.BlockingRemoveLastAndAddFirstString(1, "source", "target", 1);
-// Assert.AreEqual("def", found0.Result);
-// Assert.AreEqual("abc", found1.Result);
-// Assert.IsNull(found2.Result);
-
-// // add data from another client
-// conn.Lists.AddFirst(1, "source", "abc");
-// found0 = conn.Lists.BlockingRemoveLastAndAddFirstString(1, "source", "target", 1);
-// found1 = conn.Lists.BlockingRemoveLastAndAddFirstString(1, "source", "target", 1);
-// found2 = conn.Lists.BlockingRemoveLastAndAddFirstString(1, "source", "target", 1);
-// var found3 = conn.Lists.BlockingRemoveLastAndAddFirstString(1, "source", "target", 1);
-// conn2.Lists.AddFirst(1, "source", "def");
-// conn2.Lists.AddFirst(1, "source", "ghi");
-// Assert.AreEqual("abc", found0.Result);
-// Assert.AreEqual("def", found1.Result);
-// Assert.AreEqual("ghi", found2.Result);
-// Assert.IsNull(found3.Result);
-// }
-// }
-// [Test]
-// public void TestBlockingPopPushBytes()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// using (var conn2 = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "source");
-// conn.Keys.Remove(1, "target");
-
-// // empty
-// var found = conn.Lists.BlockingRemoveLastAndAddFirst(1, "source", "target", 1);
-// Assert.IsNull(found.Result);
-
-// // already data
-// conn.Lists.AddLast(1, "source", "abc");
-// conn.Lists.AddLast(1, "source", "def");
-// var found0 = conn.Lists.BlockingRemoveLastAndAddFirst(1, "source", "target", 1);
-// var found1 = conn.Lists.BlockingRemoveLastAndAddFirst(1, "source", "target", 1);
-// var found2 = conn.Lists.BlockingRemoveLastAndAddFirst(1, "source", "target", 1);
-// Assert.AreEqual("def", Encoding.UTF8.GetString(found0.Result));
-// Assert.AreEqual("abc", Encoding.UTF8.GetString(found1.Result));
-// Assert.IsNull(found2.Result);
-
-// // add data from another client
-// conn.Lists.AddFirst(1, "source", "abc");
-// found0 = conn.Lists.BlockingRemoveLastAndAddFirst(1, "source", "target", 1);
-// found1 = conn.Lists.BlockingRemoveLastAndAddFirst(1, "source", "target", 1);
-// found2 = conn.Lists.BlockingRemoveLastAndAddFirst(1, "source", "target", 1);
-// var found3 = conn.Lists.BlockingRemoveLastAndAddFirst(1, "source", "target", 1);
-// Thread.Sleep(100); // make sure those commands at least get queued before conn2 starts monkeying
-
-// conn2.Lists.AddFirst(1, "source", "def");
-// conn2.Lists.AddFirst(1, "source", "ghi");
-// Assert.AreEqual("abc", Encoding.UTF8.GetString(found0.Result));
-// Assert.AreEqual("def", Encoding.UTF8.GetString(found1.Result));
-// Assert.AreEqual("ghi", Encoding.UTF8.GetString(found2.Result));
-// Assert.IsNull(found3.Result);
-// }
-// }
-// }
-//}
diff --git a/MigratedBookSleeveTestSuite/Locking.cs b/MigratedBookSleeveTestSuite/Locking.cs
deleted file mode 100644
index 21b178e01..000000000
--- a/MigratedBookSleeveTestSuite/Locking.cs
+++ /dev/null
@@ -1,241 +0,0 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests
-{
- [TestFixture]
- public class Locking
- {
- [Test]
- public void AggressiveParallel()
- {
- int count = 2;
- int errorCount = 0;
- ManualResetEvent evt = new ManualResetEvent(false);
- using (var c1 = Config.GetUnsecuredConnection(waitForOpen: true))
- using (var c2 = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- WaitCallback cb = obj =>
- {
- var conn = (ConnectionMultiplexer)obj;
- conn.InternalError += delegate { Interlocked.Increment(ref errorCount); };
- conn.ErrorMessage += delegate { Interlocked.Increment(ref errorCount); };
- var db = conn.GetDatabase(2);
- for (int i = 0; i < 1000; i++)
- {
- db.LockTake("abc", "def", TimeSpan.FromSeconds(5));
- }
- db.Ping();
- conn.Close(false);
- if (Interlocked.Decrement(ref count) == 0) evt.Set();
- };
- ThreadPool.QueueUserWorkItem(cb, c1);
- ThreadPool.QueueUserWorkItem(cb, c2);
- evt.WaitOne(8000);
- }
- Assert.AreEqual(0, Interlocked.CompareExchange(ref errorCount, 0, 0));
- }
-
- [Test]
- public void TestOpCountByVersionLocal_UpLevel()
- {
- using (var conn = Config.GetUnsecuredConnection(open: false))
- {
- TestLockOpCountByVersion(conn, 1, false);
- TestLockOpCountByVersion(conn, 1, true);
- //TestManualLockOpCountByVersion(conn, 5, false);
- //TestManualLockOpCountByVersion(conn, 3, true);
- }
- }
- //[Test]
- //public void TestOpCountByVersionLocal_DownLevel()
- //{
- // var config = new ConfigurationOptions
- // {
- // EndPoints = { { Config.LocalHost } },
- // DefaultVersion = new Version(2, 6, 0),
- // CommandMap = CommandMap.Create(
- // new HashSet { "info" }, false)
- // };
- // using (var conn = ConnectionMultiplexer.Connect(config))
- // {
- // TestLockOpCountByVersion(conn, 5, false);
- // TestLockOpCountByVersion(conn, 3, true);
- // //TestManualLockOpCountByVersion(conn, 5, false);
- // //TestManualLockOpCountByVersion(conn, 3, true);
- // }
- //}
-
- //[Test]
- //public void TestOpCountByVersionRemote()
- //{
- // using (var conn = Config.GetRemoteConnection(open: false))
- // {
- // TestLockOpCountByVersion(conn, 1, false);
- // TestLockOpCountByVersion(conn, 1, true);
- // //TestManualLockOpCountByVersion(conn, 1, false);
- // //TestManualLockOpCountByVersion(conn, 1, true);
- // }
- //}
- public void TestLockOpCountByVersion(ConnectionMultiplexer conn, int expected, bool existFirst)
- {
- const int DB = 0, LockDuration = 30;
- const string Key = "TestOpCountByVersion";
-
- var db = conn.GetDatabase(DB);
- db.KeyDelete(Key);
- var newVal = "us:" + Config.CreateUniqueName();
- string expectedVal = newVal;
- if (existFirst)
- {
- expectedVal = "other:" + Config.CreateUniqueName();
- db.StringSet(Key, expectedVal, TimeSpan.FromSeconds(LockDuration));
- }
- long countBefore = conn.GetCounters().Interactive.OperationCount;
- var taken = db.LockTake(Key, newVal, TimeSpan.FromSeconds(LockDuration));
- long countAfter = conn.GetCounters().Interactive.OperationCount;
- string valAfter = db.StringGet(Key);
- Assert.AreEqual(!existFirst, taken, "lock taken");
- Assert.AreEqual(expectedVal, valAfter, "taker");
- Console.WriteLine("{0} ops before, {1} ops after", countBefore, countAfter);
- Assert.AreEqual(expected, (countAfter - countBefore), "expected ops (including ping)");
- // note we get a ping from GetCounters
- }
-
- [Test]
- public void TakeLockAndExtend()
- {
- using (var conn = Config.GetUnsecuredConnection())
- {
- string right = Guid.NewGuid().ToString(),
- wrong = Guid.NewGuid().ToString();
-
- const int DB = 7;
- const string Key = "lock-key";
-
- //conn.SuspendFlush();
- var db = conn.GetDatabase(DB);
-
- db.KeyDelete(Key);
- var t1 = db.LockTakeAsync(Key, right, TimeSpan.FromSeconds(20));
- var t1b = db.LockTakeAsync(Key, wrong, TimeSpan.FromSeconds(10));
- var t2 = db.StringGetAsync(Key);
- var t3 = db.LockReleaseAsync(Key, wrong);
- var t4 = db.StringGetAsync(Key);
- var t5 = db.LockExtendAsync(Key, wrong, TimeSpan.FromSeconds(60));
- var t6 = db.StringGetAsync(Key);
- var t7 = db.KeyTimeToLiveAsync(Key);
- var t8 = db.LockExtendAsync(Key, right, TimeSpan.FromSeconds(60));
- var t9 = db.StringGetAsync(Key);
- var t10 = db.KeyTimeToLiveAsync(Key);
- var t11 = db.LockReleaseAsync(Key, right);
- var t12 = db.StringGetAsync(Key);
- var t13 = db.LockTakeAsync(Key, wrong, TimeSpan.FromSeconds(10));
-
- Assert.IsNotNull(right);
- Assert.IsNotNull(wrong);
- Assert.AreNotEqual(right, (string)wrong);
- Assert.IsTrue(conn.Wait(t1), "1");
- Assert.IsFalse(conn.Wait(t1b), "1b");
- Assert.AreEqual(right, (string)conn.Wait(t2), "2");
- Assert.IsFalse(conn.Wait(t3), "3");
- Assert.AreEqual(right, (string)conn.Wait(t4), "4");
- Assert.IsFalse(conn.Wait(t5), "5");
- Assert.AreEqual(right, (string)conn.Wait(t6), "6");
- var ttl = conn.Wait(t7).Value.TotalSeconds;
- Assert.IsTrue(ttl > 0 && ttl <= 20, "7");
- Assert.IsTrue(conn.Wait(t8), "8");
- Assert.AreEqual(right, (string)conn.Wait(t9), "9");
- ttl = conn.Wait(t10).Value.TotalSeconds;
- Assert.IsTrue(ttl > 50 && ttl <= 60, "10");
- Assert.IsTrue(conn.Wait(t11), "11");
- Assert.IsNull((string)conn.Wait(t12), "12");
- Assert.IsTrue(conn.Wait(t13), "13");
- }
- }
-
-
- ////public void TestManualLockOpCountByVersion(RedisConnection conn, int expected, bool existFirst)
- ////{
- //// const int DB = 0, LockDuration = 30;
- //// const string Key = "TestManualLockOpCountByVersion";
- //// conn.Wait(conn.Open());
- //// conn.Keys.Remove(DB, Key);
- //// var newVal = "us:" + Config.CreateUniqueName();
- //// string expectedVal = newVal;
- //// if (existFirst)
- //// {
- //// expectedVal = "other:" + Config.CreateUniqueName();
- //// conn.Strings.Set(DB, Key, expectedVal, LockDuration);
- //// }
- //// int countBefore = conn.GetCounters().MessagesSent;
-
- //// var tran = conn.CreateTransaction();
- //// tran.AddCondition(Condition.KeyNotExists(DB, Key));
- //// tran.Strings.Set(DB, Key, newVal, LockDuration);
- //// var taken = conn.Wait(tran.Execute());
-
- //// int countAfter = conn.GetCounters().MessagesSent;
- //// var valAfter = conn.Wait(conn.Strings.GetString(DB, Key));
- //// Assert.AreEqual(!existFirst, taken, "lock taken (manual)");
- //// Assert.AreEqual(expectedVal, valAfter, "taker (manual)");
- //// Assert.AreEqual(expected, (countAfter - countBefore) - 1, "expected ops (including ping) (manual)");
- //// // note we get a ping from GetCounters
- ////}
-
-
-
- [Test]
- public void TestBasicLockNotTaken()
- {
- using (var conn = Config.GetUnsecuredConnection())
- {
- int errorCount = 0;
-
- conn.InternalError += delegate { Interlocked.Increment(ref errorCount); };
-
- var db = conn.GetDatabase(0);
- Task taken = null;
- Task newValue = null;
- Task ttl = null;
-
- const int LOOP = 50;
- for (int i = 0; i < LOOP; i++)
- {
- db.KeyDeleteAsync("lock-not-exists");
- taken = db.LockTakeAsync("lock-not-exists", "new-value", TimeSpan.FromSeconds(10));
- newValue = db.StringGetAsync("lock-not-exists");
- ttl = db.KeyTimeToLiveAsync("lock-not-exists");
- }
- Assert.IsTrue(conn.Wait(taken), "taken");
- Assert.AreEqual("new-value", (string)conn.Wait(newValue));
- var ttlValue = conn.Wait(ttl).Value.TotalSeconds;
- Assert.IsTrue(ttlValue >= 8 && ttlValue <= 10, "ttl");
-
- Assert.AreEqual(0, errorCount);
- }
- }
-
- [Test]
- public void TestBasicLockTaken()
- {
- using (var conn = Config.GetUnsecuredConnection())
- {
- var db = conn.GetDatabase(0);
- db.KeyDelete("lock-exists");
- db.StringSet("lock-exists", "old-value", TimeSpan.FromSeconds(20));
- var taken = db.LockTakeAsync("lock-exists", "new-value", TimeSpan.FromSeconds(10));
- var newValue = db.StringGetAsync("lock-exists");
- var ttl = db.KeyTimeToLiveAsync("lock-exists");
-
- Assert.IsFalse(conn.Wait(taken), "taken");
- Assert.AreEqual("old-value", (string)conn.Wait(newValue));
- var ttlValue = conn.Wait(ttl).Value.TotalSeconds;
- Assert.IsTrue(ttlValue >= 18 && ttlValue <= 20, "ttl");
- }
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/MigratedBookSleeveTestSuite.csproj b/MigratedBookSleeveTestSuite/MigratedBookSleeveTestSuite.csproj
deleted file mode 100644
index 2fab71e24..000000000
--- a/MigratedBookSleeveTestSuite/MigratedBookSleeveTestSuite.csproj
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
- MigratedBookSleeveTestSuite
- net45;netcoreapp1.0
- MigratedBookSleeveTestSuite
- MigratedBookSleeveTestSuite
- false
- true
- $(PackageTargetFallback);portable-net45+win8
- 1.0.4
- false
- false
- false
- false
- false
- false
- false
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(DefineConstants);PLAT_SAFE_CONTINUATIONS;CORE_CLR
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/MigratedBookSleeveTestSuite/Performance.cs b/MigratedBookSleeveTestSuite/Performance.cs
deleted file mode 100644
index 0b17549e2..000000000
--- a/MigratedBookSleeveTestSuite/Performance.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Text;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests
-{
- [TestFixture]
- public class Performance
- {
- [Test]
- public void VerifyPerformanceImprovement()
- {
- int asyncTimer, sync, op = 0, asyncFaF, syncFaF;
- using (var muxer= Config.GetUnsecuredConnection())
- {
- // do these outside the timings, just to ensure the core methods are JITted etc
- for (int db = 0; db < 5; db++)
- {
- muxer.GetDatabase(db).KeyDeleteAsync("perftest");
- }
-
- var timer = Stopwatch.StartNew();
- for (int i = 0; i < 100; i++)
- {
- // want to test multiplex scenario; test each db, but to make it fair we'll
- // do in batches of 10 on each
- for (int db = 0; db < 5; db++)
- {
- var conn = muxer.GetDatabase(db);
- for (int j = 0; j < 10; j++)
- conn.StringIncrementAsync("perftest");
- }
- }
- asyncFaF = (int)timer.ElapsedMilliseconds;
- Task[] final = new Task[5];
- for (int db = 0; db < 5; db++)
- final[db] = muxer.GetDatabase(db).StringGetAsync("perftest");
- muxer.WaitAll(final);
- timer.Stop();
- asyncTimer = (int)timer.ElapsedMilliseconds;
- Console.WriteLine("async to completion (local): {0}ms", timer.ElapsedMilliseconds);
- for (int db = 0; db < 5; db++)
- Assert.AreEqual(1000, (long)final[db].Result, "async, db:" + db);
- }
-
- using (var conn = new Redis(Config.LocalHost, 6379))
- {
- // do these outside the timings, just to ensure the core methods are JITted etc
- for (int db = 0; db < 5; db++)
- {
- conn.Db = db;
- conn.Remove("perftest");
- }
-
- var timer = Stopwatch.StartNew();
- for (int i = 0; i < 100; i++)
- {
- // want to test multiplex scenario; test each db, but to make it fair we'll
- // do in batches of 10 on each
- for (int db = 0; db < 5; db++)
- {
- conn.Db = db;
- op++;
- for (int j = 0; j < 10; j++)
- {
- conn.Increment("perftest");
- op++;
- }
- }
- }
- syncFaF = (int)timer.ElapsedMilliseconds;
- string[] final = new string[5];
- for (int db = 0; db < 5; db++)
- {
- conn.Db = db;
- final[db] = Encoding.ASCII.GetString(conn.Get("perftest"));
- }
- timer.Stop();
- sync = (int)timer.ElapsedMilliseconds;
- Console.WriteLine("sync to completion (local): {0}ms", timer.ElapsedMilliseconds);
- for (int db = 0; db < 5; db++)
- Assert.AreEqual("1000", final[db], "async, db:" + db);
- }
- int effectiveAsync = ((10 * asyncTimer) + 3) / 10;
- int effectiveSync = ((10 * sync) + (op * 3)) / 10;
- Console.WriteLine("async to completion with assumed 0.3ms LAN latency: " + effectiveAsync);
- Console.WriteLine("sync to completion with assumed 0.3ms LAN latency: " + effectiveSync);
- Console.WriteLine("fire-and-forget: {0}ms sync vs {1}ms async ", syncFaF, asyncFaF);
- Assert.Less(effectiveAsync, effectiveSync, "Everything");
- Assert.Less(asyncFaF, syncFaF, "Fire and Forget");
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Program.cs b/MigratedBookSleeveTestSuite/Program.cs
deleted file mode 100644
index 0d204d272..000000000
--- a/MigratedBookSleeveTestSuite/Program.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Threading.Tasks;
-using NUnit.Framework;
-
-namespace Tests
-{
- class Program
- {
- // static void Main()
- // {
- // try
- // {
- // Main2();
- // }
- // catch (Exception ex)
- // {
- // Console.WriteLine();
- // Console.WriteLine("CRAZY ERRORS: " + ex);
- // }
- // finally
- // {
- // Console.WriteLine("Press any key to exit");
- // Console.ReadKey();
- // }
- // }
- static void Main2()
- {
-#if !CORE_CLR
- // why is this here? because some dumbass forgot to install a decent test-runner before going to the airport
- var epicFail = new List();
- var testTypes = from type in typeof(Program).Assembly.GetTypes()
- where Attribute.IsDefined(type, typeof(TestFixtureAttribute))
- && !Attribute.IsDefined(type, typeof(IgnoreAttribute))
- let methods = type.GetMethods()
- select new
- {
- Type = type,
- Methods = methods,
- ActiveMethods = methods.Where(x => Attribute.IsDefined(x, typeof(ActiveTestAttribute))).ToArray(),
- Setup = methods.SingleOrDefault(x => Attribute.IsDefined(x, typeof(OneTimeSetUpAttribute))),
- TearDown = methods.SingleOrDefault(x => Attribute.IsDefined(x, typeof(OneTimeTearDownAttribute)))
- };
- int pass = 0, fail = 0;
-
- bool activeOnly = testTypes.SelectMany(x => x.ActiveMethods).Any();
-
- TaskScheduler.UnobservedTaskException += (sender, args) =>
- {
- args.SetObserved();
- //if (args.Exception is AggregateException)
- //{
- // foreach (var ex in ((AggregateException)args.Exception).InnerExceptions)
- // {
- // Console.WriteLine(ex.Message);
- // }
- //}
- //else
- //{
- // Console.WriteLine(args.Exception.Message);
- //}
- };
-
- foreach (var type in testTypes)
- {
- var tests = (from method in (activeOnly ? type.ActiveMethods : type.Methods)
- where Attribute.IsDefined(method, typeof(TestAttribute))
- && !Attribute.IsDefined(method, typeof(IgnoreAttribute))
- select method).ToArray();
-
- if (tests.Length == 0) continue;
-
- Console.WriteLine(type.Type.FullName);
- object obj;
- try
- {
- obj = Activator.CreateInstance(type.Type);
- if (obj == null) throw new InvalidOperationException("the world has gone mad");
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- continue;
- }
- using (obj as IDisposable)
- {
- if (type.Setup != null)
- {
- try
- { type.Setup.Invoke(obj, null); }
- catch (Exception ex)
- {
- Console.WriteLine("Test fixture startup failed: " + ex.Message);
- fail++;
- epicFail.Add(type.Setup.DeclaringType.FullName + "." + type.Setup.Name);
- continue;
- }
- }
-
- foreach (var test in tests)
- {
- Console.Write(test.Name + ": ");
- Exception err = null;
-
- try
- {
- int count = 1;
- if (activeOnly)
- {
- var ata = test.GetCustomAttribute(typeof(ActiveTestAttribute)) as ActiveTestAttribute;
- if (ata != null) count = ata.Count;
- }
- while (count-- > 0)
- {
- test.Invoke(obj, null);
- }
- }
- catch (TargetInvocationException ex)
- {
- err = ex.InnerException;
- }
- catch (Exception ex)
- {
- err = ex;
- }
-
- if (err is AggregateException && ((AggregateException)err).InnerExceptions.Count == 1)
- {
- err = ((AggregateException)err).InnerExceptions[0];
- }
-
- if (err == null)
- {
- Console.WriteLine("pass");
- pass++;
- }
- else
- {
- Console.WriteLine(err.Message);
- fail++;
- epicFail.Add(test.DeclaringType.FullName + "." + test.Name);
- }
- }
- if (type.TearDown != null)
- {
- try
- { type.TearDown.Invoke(obj, null); }
- catch (Exception ex)
- {
- Console.WriteLine("Test fixture teardown failed: " + ex.Message);
- fail++;
- epicFail.Add(type.TearDown.DeclaringType.FullName + "." + type.TearDown.Name);
- }
- }
- }
- }
- Console.WriteLine("Passed: {0}; Failed: {1}", pass, fail);
- foreach (var msg in epicFail) Console.WriteLine(msg);
-//#if DEBUG
-// Console.WriteLine();
-// Console.WriteLine("Callbacks: {0:###,###,##0} sync, {1:###,###,##0} async",
-// BookSleeve.RedisConnectionBase.AllSyncCallbacks, BookSleeve.RedisConnectionBase.AllAsyncCallbacks);
-//#endif
-
-#endif
- }
- }
-}
-
-[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
-public sealed class ActiveTestAttribute : Attribute
-{
- public int Count { get; }
- public ActiveTestAttribute() : this(1) { }
- public ActiveTestAttribute(int count) { this.Count = count; }
-}
\ No newline at end of file
diff --git a/MigratedBookSleeveTestSuite/Properties/AssemblyInfo.cs b/MigratedBookSleeveTestSuite/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9dc391d1f..000000000
--- a/MigratedBookSleeveTestSuite/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("MigratedBookSleeveTestSuite")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MigratedBookSleeveTestSuite")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("350d3b30-78dd-4b74-a76d-bb593a05e8d1")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/MigratedBookSleeveTestSuite/PubSub.cs b/MigratedBookSleeveTestSuite/PubSub.cs
deleted file mode 100644
index c6af2cb86..000000000
--- a/MigratedBookSleeveTestSuite/PubSub.cs
+++ /dev/null
@@ -1,269 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests
-{
- [TestFixture]
- public class PubSub // http://redis.io/commands#pubsub
- {
- [Test]
- public void TestPublishWithNoSubscribers()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetSubscriber();
- Assert.AreEqual(0, conn.Publish("channel", "message"));
- }
- }
-
- [Test]
- public void TestMassivePublishWithWithoutFlush_Local()
- {
- using (var muxer = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- var conn = muxer.GetSubscriber();
- TestMassivePublish(conn, "local");
- }
- }
- [Test]
- public void TestMassivePublishWithWithoutFlush_Remote()
- {
- using (var muxer = Config.GetRemoteConnection(waitForOpen: true))
- {
- var conn = muxer.GetSubscriber();
- TestMassivePublish(conn, "remote");
- }
- }
-
- private void TestMassivePublish(ISubscriber conn, string caption)
- {
- const int loop = 100000;
-
- GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
- GC.WaitForPendingFinalizers();
-
- var tasks = new Task[loop];
-
- var withFAF = Stopwatch.StartNew();
- for (int i = 0; i < loop; i++)
- conn.Publish("foo", "bar", CommandFlags.FireAndForget);
- withFAF.Stop();
-
- GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
- GC.WaitForPendingFinalizers();
-
- var withAsync = Stopwatch.StartNew();
- for (int i = 0; i < loop; i++)
- tasks[i] = conn.PublishAsync("foo", "bar");
- conn.WaitAll(tasks);
- withAsync.Stop();
-
- Assert.Less(1, 2, "sanity check");
- Assert.Less(withFAF.ElapsedMilliseconds, withAsync.ElapsedMilliseconds, caption);
- Console.WriteLine("{2}: {0}ms (F+F) vs {1}ms (async)",
- withFAF.ElapsedMilliseconds, withAsync.ElapsedMilliseconds, caption);
- }
-
-
- [Test]
- public void PubSubOrder()
- {
- using (var muxer = Config.GetRemoteConnection(waitForOpen: true))
- {
- var sub = muxer.GetSubscriber();
- string channel = "PubSubOrder";
- const int count = 500000;
- object syncLock = new object();
-
- List data = new List(count);
- muxer.PreserveAsyncOrder = true;
- sub.SubscribeAsync(channel, (key, val) =>
- {
- bool pulse;
- lock (data)
- {
- data.Add(int.Parse(Encoding.UTF8.GetString(val)));
- pulse = data.Count == count;
- if ((data.Count % 10) == 99) Console.WriteLine(data.Count);
- }
- if (pulse)
- lock (syncLock)
- Monitor.PulseAll(syncLock);
- }).Wait();
-
- lock (syncLock)
- {
- for (int i = 0; i < count; i++)
- {
- sub.Publish(channel, i.ToString(), CommandFlags.FireAndForget);
- }
- sub.Ping();
- if (!Monitor.Wait(syncLock, 10000))
- {
- throw new TimeoutException("Items: " + data.Count);
- }
- for (int i = 0; i < count; i++)
- Assert.AreEqual(i, data[i]);
- }
- }
-
- }
-
- [Test]
- public void TestPublishWithSubscribers()
- {
- using (var muxerA = Config.GetUnsecuredConnection())
- using (var muxerB = Config.GetUnsecuredConnection())
- using (var conn = Config.GetUnsecuredConnection())
- {
- var listenA = muxerA.GetSubscriber();
- var listenB = muxerB.GetSubscriber();
- var t1 = listenA.SubscribeAsync("channel", delegate { });
- var t2 = listenB.SubscribeAsync("channel", delegate { });
-
- listenA.Wait(t1);
- listenB.Wait(t2);
-
- var pub = conn.GetSubscriber().PublishAsync("channel", "message");
- Assert.AreEqual(2, conn.Wait(pub), "delivery count");
- }
- }
-
- [Test]
- public void TestMultipleSubscribersGetMessage()
- {
- using (var muxerA = Config.GetUnsecuredConnection())
- using (var muxerB = Config.GetUnsecuredConnection())
- using (var conn = Config.GetUnsecuredConnection())
- {
- var listenA = muxerA.GetSubscriber();
- var listenB = muxerB.GetSubscriber();
- conn.GetDatabase().Ping();
- var pub = conn.GetSubscriber();
- int gotA = 0, gotB = 0;
- var tA = listenA.SubscribeAsync("channel", (s, msg) => { if (msg == "message") Interlocked.Increment(ref gotA); });
- var tB = listenB.SubscribeAsync("channel", (s, msg) => { if (msg == "message") Interlocked.Increment(ref gotB); });
- listenA.Wait(tA);
- listenB.Wait(tB);
- Assert.AreEqual(2, pub.Publish("channel", "message"));
- AllowReasonableTimeToPublishAndProcess();
- Assert.AreEqual(1, Interlocked.CompareExchange(ref gotA, 0, 0));
- Assert.AreEqual(1, Interlocked.CompareExchange(ref gotB, 0, 0));
-
- // and unsubscibe...
- tA = listenA.UnsubscribeAsync("channel");
- listenA.Wait(tA);
- Assert.AreEqual(1, pub.Publish("channel", "message"));
- AllowReasonableTimeToPublishAndProcess();
- Assert.AreEqual(1, Interlocked.CompareExchange(ref gotA, 0, 0));
- Assert.AreEqual(2, Interlocked.CompareExchange(ref gotB, 0, 0));
- }
- }
-
- [Test]
- public void Issue38()
- { // https://code.google.com/p/booksleeve/issues/detail?id=38
-
- using (var pub = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- var sub = pub.GetSubscriber();
- int count = 0;
- Action handler = (channel, payload) => Interlocked.Increment(ref count);
- var a0 = sub.SubscribeAsync("foo", handler);
- var a1 = sub.SubscribeAsync("bar", handler);
- var b0 = sub.SubscribeAsync("f*o", handler);
- var b1 = sub.SubscribeAsync("b*r", handler);
- sub.WaitAll(a0, a1, b0, b1);
-
- var c = sub.PublishAsync("foo", "foo");
- var d = sub.PublishAsync("f@o", "f@o");
- var e = sub.PublishAsync("bar", "bar");
- var f = sub.PublishAsync("b@r", "b@r");
-
- pub.WaitAll(c, d, e, f);
- long total = c.Result + d.Result + e.Result + f.Result;
-
- AllowReasonableTimeToPublishAndProcess();
-
- Assert.AreEqual(6, total, "sent");
- Assert.AreEqual(6, Interlocked.CompareExchange(ref count, 0, 0), "received");
-
-
- }
- }
-
- internal static void AllowReasonableTimeToPublishAndProcess()
- {
- Thread.Sleep(50);
- }
-
- [Test]
- public void TestPartialSubscriberGetMessage()
- {
- using (var muxerA = Config.GetUnsecuredConnection())
- using (var muxerB = Config.GetUnsecuredConnection())
- using (var conn = Config.GetUnsecuredConnection())
- {
- int gotA = 0, gotB = 0;
- var listenA = muxerA.GetSubscriber();
- var listenB = muxerB.GetSubscriber();
- var pub = conn.GetSubscriber();
- var tA = listenA.SubscribeAsync("channel", (s, msg) => { if (s == "channel" && msg == "message") Interlocked.Increment(ref gotA); });
- var tB = listenB.SubscribeAsync("chann*", (s, msg) => { if (s == "channel" && msg == "message") Interlocked.Increment(ref gotB); });
- listenA.Wait(tA);
- listenB.Wait(tB);
- Assert.AreEqual(2, pub.Publish("channel", "message"));
- AllowReasonableTimeToPublishAndProcess();
- Assert.AreEqual(1, Interlocked.CompareExchange(ref gotA, 0, 0));
- Assert.AreEqual(1, Interlocked.CompareExchange(ref gotB, 0, 0));
-
- // and unsubscibe...
- tB = listenB.UnsubscribeAsync("chann*", null);
- listenB.Wait(tB);
- Assert.AreEqual(1, pub.Publish("channel", "message"));
- AllowReasonableTimeToPublishAndProcess();
- Assert.AreEqual(2, Interlocked.CompareExchange(ref gotA, 0, 0));
- Assert.AreEqual(1, Interlocked.CompareExchange(ref gotB, 0, 0));
- }
- }
-
- [Test]
- public void TestSubscribeUnsubscribeAndSubscribeAgain()
- {
- using (var pubMuxer = Config.GetUnsecuredConnection())
- using (var subMuxer = Config.GetUnsecuredConnection())
- {
- var pub = pubMuxer.GetSubscriber();
- var sub = subMuxer.GetSubscriber();
- int x = 0, y = 0;
- var t1 = sub.SubscribeAsync("abc", delegate { Interlocked.Increment(ref x); });
- var t2 = sub.SubscribeAsync("ab*", delegate { Interlocked.Increment(ref y); });
- sub.WaitAll(t1, t2);
- pub.Publish("abc", "");
- AllowReasonableTimeToPublishAndProcess();
- Assert.AreEqual(1, Volatile.Read(ref x));
- Assert.AreEqual(1, Volatile.Read(ref y));
- t1 = sub.UnsubscribeAsync("abc", null);
- t2 = sub.UnsubscribeAsync("ab*", null);
- sub.WaitAll(t1, t2);
- pub.Publish("abc", "");
- Assert.AreEqual(1, Volatile.Read(ref x));
- Assert.AreEqual(1, Volatile.Read(ref y));
- t1 = sub.SubscribeAsync("abc", delegate { Interlocked.Increment(ref x); });
- t2 = sub.SubscribeAsync("ab*", delegate { Interlocked.Increment(ref y); });
- sub.WaitAll(t1, t2);
- pub.Publish("abc", "");
- AllowReasonableTimeToPublishAndProcess();
- Assert.AreEqual(2, Volatile.Read(ref x));
- Assert.AreEqual(2, Volatile.Read(ref y));
-
- }
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Scripting.cs b/MigratedBookSleeveTestSuite/Scripting.cs
deleted file mode 100644
index dff281bd4..000000000
--- a/MigratedBookSleeveTestSuite/Scripting.cs
+++ /dev/null
@@ -1,369 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests
-{
- [TestFixture]
- public class Scripting
- {
- static ConnectionMultiplexer GetScriptConn(bool allowAdmin = false)
- {
- int syncTimeout = 5000;
- if (Debugger.IsAttached) syncTimeout = 500000;
- var muxer = Config.GetUnsecuredConnection(waitForOpen: true, allowAdmin: allowAdmin, syncTimeout: syncTimeout);
- if (!Config.GetFeatures(muxer).Scripting)
- {
- Assert.Inconclusive("The server does not support scripting");
- }
- return muxer;
-
- }
- [Test]
- public void ClientScripting()
- {
- using (var conn = GetScriptConn())
- {
- var result = conn.GetDatabase().ScriptEvaluate("return redis.call('info','server')", null, null);
- }
- }
-
- [Test]
- public void BasicScripting()
- {
- using (var muxer = GetScriptConn())
- {
- var conn = muxer.GetDatabase();
- var noCache = conn.ScriptEvaluateAsync("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}",
- new RedisKey[] { "key1", "key2" }, new RedisValue[] { "first", "second" });
- var cache = conn.ScriptEvaluateAsync("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}",
- new RedisKey[] { "key1", "key2" }, new RedisValue[] { "first", "second" });
- var results = (string[])conn.Wait(noCache);
- Assert.AreEqual(4, results.Length);
- Assert.AreEqual("key1", results[0]);
- Assert.AreEqual("key2", results[1]);
- Assert.AreEqual("first", results[2]);
- Assert.AreEqual("second", results[3]);
-
- results = (string[])conn.Wait(cache);
- Assert.AreEqual(4, results.Length);
- Assert.AreEqual("key1", results[0]);
- Assert.AreEqual("key2", results[1]);
- Assert.AreEqual("first", results[2]);
- Assert.AreEqual("second", results[3]);
- }
- }
- [Test]
- public void KeysScripting()
- {
- using (var muxer = GetScriptConn())
- {
- var conn = muxer.GetDatabase();
- conn.StringSet("foo", "bar");
- var result = (string)conn.ScriptEvaluate("return redis.call('get', KEYS[1])", new RedisKey[] { "foo" }, null);
- Assert.AreEqual("bar", result);
- }
- }
-
- [Test]
- public void TestRandomThingFromForum()
- {
- const string script = @"local currentVal = tonumber(redis.call('GET', KEYS[1]));
- if (currentVal <= 0 ) then return 1 elseif (currentVal - (tonumber(ARGV[1])) < 0 ) then return 0 end;
- return redis.call('INCRBY', KEYS[1], -tonumber(ARGV[1]));";
-
- using (var muxer = GetScriptConn())
- {
- var conn = muxer.GetDatabase();
- conn.StringSetAsync("A", "0");
- conn.StringSetAsync("B", "5");
- conn.StringSetAsync("C", "10");
-
- var a = conn.ScriptEvaluateAsync(script, new RedisKey[] { "A" }, new RedisValue[] { 6 });
- var b = conn.ScriptEvaluateAsync(script, new RedisKey[] { "B" }, new RedisValue[] { 6 });
- var c = conn.ScriptEvaluateAsync(script, new RedisKey[] { "C" }, new RedisValue[] { 6 });
-
- var vals = conn.StringGetAsync(new RedisKey[] { "A", "B", "C" });
-
- Assert.AreEqual(1, (long)conn.Wait(a)); // exit code when current val is non-positive
- Assert.AreEqual(0, (long)conn.Wait(b)); // exit code when result would be negative
- Assert.AreEqual(4, (long)conn.Wait(c)); // 10 - 6 = 4
- Assert.AreEqual("0", (string)conn.Wait(vals)[0]);
- Assert.AreEqual("5", (string)conn.Wait(vals)[1]);
- Assert.AreEqual("4", (string)conn.Wait(vals)[2]);
- }
- }
-
- [Test]
- public void HackyGetPerf()
- {
- using (var muxer = GetScriptConn())
- {
- var conn = muxer.GetDatabase();
- conn.StringSetAsync("foo", "bar");
- var key = Config.CreateUniqueName();
- var result = (long)conn.ScriptEvaluate(@"
-redis.call('psetex', KEYS[1], 60000, 'timing')
-for i = 1,100000 do
- redis.call('set', 'ignore','abc')
-end
-local timeTaken = 60000 - redis.call('pttl', KEYS[1])
-redis.call('del', KEYS[1])
-return timeTaken
-", new RedisKey[] { key }, null);
- Console.WriteLine(result);
- Assert.IsTrue(result > 0);
- }
- }
-
- [Test]
- public void MultiIncrWithoutReplies()
- {
- using (var muxer = GetScriptConn())
- {
- const int DB = 0; // any database number
- var conn = muxer.GetDatabase(DB);
- // prime some initial values
- conn.KeyDeleteAsync(new RedisKey[] { "a", "b", "c" });
- conn.StringIncrementAsync("b");
- conn.StringIncrementAsync("c");
- conn.StringIncrementAsync("c");
-
- // run the script, passing "a", "b", "c", "c" to
- // increment a & b by 1, c twice
- var result = conn.ScriptEvaluateAsync(
- @"for i,key in ipairs(KEYS) do redis.call('incr', key) end",
- new RedisKey[] { "a", "b", "c", "c" }, // <== aka "KEYS" in the script
- null); // <== aka "ARGV" in the script
-
- // check the incremented values
- var a = conn.StringGetAsync("a");
- var b = conn.StringGetAsync("b");
- var c = conn.StringGetAsync("c");
-
- Assert.IsTrue(conn.Wait(result).IsNull, "result");
- Assert.AreEqual(1, (long)conn.Wait(a), "a");
- Assert.AreEqual(2, (long)conn.Wait(b), "b");
- Assert.AreEqual(4, (long)conn.Wait(c), "c");
- }
- }
-
- [Test]
- public void MultiIncrByWithoutReplies()
- {
- using (var muxer = GetScriptConn())
- {
- const int DB = 0; // any database number
- var conn = muxer.GetDatabase(DB);
- // prime some initial values
- conn.KeyDeleteAsync(new RedisKey[] { "a", "b", "c" });
- conn.StringIncrementAsync("b");
- conn.StringIncrementAsync("c");
- conn.StringIncrementAsync("c");
-
- //run the script, passing "a", "b", "c" and 1,2,3
- // increment a &b by 1, c twice
- var result = conn.ScriptEvaluateAsync(
- @"for i,key in ipairs(KEYS) do redis.call('incrby', key, ARGV[i]) end",
- new RedisKey[] { "a", "b", "c" }, // <== aka "KEYS" in the script
- new RedisValue[] { 1, 1, 2 }); // <== aka "ARGV" in the script
-
- // check the incremented values
- var a = conn.StringGetAsync("a");
- var b = conn.StringGetAsync("b");
- var c = conn.StringGetAsync("c");
-
- Assert.IsTrue(conn.Wait(result).IsNull, "result");
- Assert.AreEqual(1, (long)conn.Wait(a), "a");
- Assert.AreEqual(2, (long)conn.Wait(b), "b");
- Assert.AreEqual(4, (long)conn.Wait(c), "c");
- }
- }
-
- [Test]
- public void DisableStringInference()
- {
- using (var muxer = GetScriptConn())
- {
- var conn = muxer.GetDatabase(0);
- conn.StringSet("foo", "bar");
- var result = (byte[])conn.ScriptEvaluate("return redis.call('get', KEYS[1])", new RedisKey[] { "foo" });
- Assert.AreEqual("bar", Encoding.UTF8.GetString(result));
- }
- }
-
- [Test]
- public void FlushDetection()
- { // we don't expect this to handle everything; we just expect it to be predictable
- using (var muxer = GetScriptConn(allowAdmin: true))
- {
- var conn = muxer.GetDatabase(0);
- conn.StringSet("foo", "bar");
- var result = (string)conn.ScriptEvaluate("return redis.call('get', KEYS[1])", new RedisKey[] { "foo" }, null);
- Assert.AreEqual("bar", result);
-
- // now cause all kinds of problems
- Config.GetServer(muxer).ScriptFlush();
-
- //expect this one to fail just work fine (self-fix)
- conn.ScriptEvaluate("return redis.call('get', KEYS[1])", new RedisKey[] { "foo" }, null);
-
- result = (string)conn.ScriptEvaluate("return redis.call('get', KEYS[1])", new RedisKey[] { "foo" }, null);
- Assert.AreEqual("bar", result);
- }
- }
-
- [Test]
- public void PrepareScript()
- {
- string[] scripts = { "return redis.call('get', KEYS[1])", "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" };
- using (var muxer = GetScriptConn(allowAdmin: true))
- {
- var server = Config.GetServer(muxer);
- server.ScriptFlush();
-
- // when vanilla
- server.ScriptLoad(scripts[0]);
- server.ScriptLoad(scripts[1]);
-
- //when known to exist
- server.ScriptLoad(scripts[0]);
- server.ScriptLoad(scripts[1]);
- }
- using (var muxer = GetScriptConn())
- {
- var server = Config.GetServer(muxer);
-
- //when vanilla
- server.ScriptLoad(scripts[0]);
- server.ScriptLoad(scripts[1]);
-
- //when known to exist
- server.ScriptLoad(scripts[0]);
- server.ScriptLoad(scripts[1]);
-
- //when known to exist
- server.ScriptLoad(scripts[0]);
- server.ScriptLoad(scripts[1]);
- }
- }
- [Test]
- public void NonAsciiScripts()
- {
- using (var muxer = GetScriptConn())
- {
- const string evil = "return '僕'";
- var conn = muxer.GetDatabase(0);
- Config.GetServer(muxer).ScriptLoad(evil);
-
- var result = (string)conn.ScriptEvaluate(evil, null, null);
- Assert.AreEqual("僕", result);
- }
- }
-
- [Test]
- public void ScriptThrowsError()
- {
- Assert.Throws(() =>
- {
- using (var muxer = GetScriptConn())
- {
- var conn = muxer.GetDatabase(0);
- var result = conn.ScriptEvaluateAsync("return redis.error_reply('oops')", null, null);
- try
- {
- conn.Wait(result);
- }
- catch (AggregateException ex)
- {
- throw ex.InnerExceptions[0];
- }
- }
- },
- message: "oops");
- }
-
- [Test]
- public void ScriptThrowsErrorInsideTransaction()
- {
- using (var muxer = GetScriptConn())
- {
- const int db = 0;
- const string key = "ScriptThrowsErrorInsideTransaction";
- var conn = muxer.GetDatabase(db);
- conn.KeyDeleteAsync(key);
- var beforeTran = (string)conn.StringGet(key);
- Assert.IsNull(beforeTran);
- var tran = conn.CreateTransaction();
- {
- var a = tran.StringIncrementAsync(key);
- var b = tran.ScriptEvaluateAsync("return redis.error_reply('oops')", null, null);
- var c = tran.StringIncrementAsync(key);
- var complete = tran.ExecuteAsync();
-
- Assert.IsTrue(tran.Wait(complete));
- Assert.IsTrue(a.IsCompleted);
- Assert.IsTrue(c.IsCompleted);
- Assert.AreEqual(1L, a.Result);
- Assert.AreEqual(2L, c.Result);
-
- Assert.IsTrue(b.IsFaulted);
- Assert.AreEqual(1, b.Exception.InnerExceptions.Count);
- var ex = b.Exception.InnerExceptions.Single();
- Assert.IsInstanceOf(ex);
- Assert.AreEqual("oops", ex.Message);
-
- }
- var afterTran = conn.StringGetAsync(key);
- Assert.AreEqual(2L, (long)conn.Wait(afterTran));
- }
- }
-
-
-
- [Test]
- public void ChangeDbInScript()
- {
- using (var muxer = GetScriptConn())
- {
- muxer.GetDatabase(1).StringSet("foo", "db 1");
- muxer.GetDatabase(2).StringSet("foo", "db 2");
-
- var conn = muxer.GetDatabase(2);
- var evalResult = conn.ScriptEvaluateAsync(@"redis.call('select', 1)
- return redis.call('get','foo')", null, null);
- var getResult = conn.StringGetAsync("foo");
-
- Assert.AreEqual("db 1", (string)conn.Wait(evalResult));
- // now, our connection thought it was in db 2, but the script changed to db 1
- Assert.AreEqual("db 2", (string)conn.Wait(getResult));
-
- }
- }
-
- [Test]
- public void ChangeDbInTranScript()
- {
- using (var muxer = GetScriptConn())
- {
- muxer.GetDatabase(1).StringSet("foo", "db 1");
- muxer.GetDatabase(2).StringSet("foo", "db 2");
-
- var conn = muxer.GetDatabase(2);
- var tran = conn.CreateTransaction();
- var evalResult = tran.ScriptEvaluateAsync(@"redis.call('select', 1)
- return redis.call('get','foo')", null, null);
- var getResult = tran.StringGetAsync("foo");
- Assert.IsTrue(tran.Execute());
-
- Assert.AreEqual("db 1", (string)conn.Wait(evalResult));
- // now, our connection thought it was in db 2, but the script changed to db 1
- Assert.AreEqual("db 2", (string)conn.Wait(getResult));
-
- }
- }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Server.cs b/MigratedBookSleeveTestSuite/Server.cs
deleted file mode 100644
index 9cc139c54..000000000
--- a/MigratedBookSleeveTestSuite/Server.cs
+++ /dev/null
@@ -1,446 +0,0 @@
-//using System.Linq;
-//using BookSleeve;
-//using NUnit.Framework;
-//using System.Threading;
-//using System;
-//using System.Threading.Tasks;
-//using System.Collections.Generic;
-//using System.Diagnostics;
-
-//namespace Tests
-//{
-// [TestFixture]
-// public class Server // http://redis.io/commands#server
-// {
-// [Test]
-// public void TestGetConfigAll()
-// {
-// using (var db = Config.GetUnsecuredConnection())
-// {
-// var pairs = db.Wait(db.Server.GetConfig("*"));
-// Assert.Greater(1, 0); // I always get double-check which arg is which
-// Assert.Greater(pairs.Count, 0);
-// }
-// }
-
-// [Test]
-// public void BGSaveAndLastSave()
-// {
-// using(var db = Config.GetUnsecuredConnection(allowAdmin: true))
-// {
-// var oldWhen = db.Server.GetLastSaveTime();
-// db.Wait(db.Server.SaveDatabase(foreground: false));
-
-// bool saved = false;
-// for(int i = 0; i < 50; i++)
-// {
-// var newWhen = db.Server.GetLastSaveTime();
-// db.Wait(newWhen);
-// if(newWhen.Result > oldWhen.Result)
-// {
-// saved = true;
-// break;
-// }
-// Console.WriteLine("waiting...");
-// Thread.Sleep(200);
-// }
-// Assert.IsTrue(saved);
-// }
-// }
-
-// [Test]
-// [TestCase(true)]
-// [TestCase(false)]
-// public void Slowlog(bool remote)
-// {
-// using(var db = remote ? Config.GetRemoteConnection(allowAdmin: true) : Config.GetUnsecuredConnection(allowAdmin: true))
-// {
-// var oldWhen = db.Wait(db.Server.Time());
-// db.Server.FlushAll();
-// db.Server.ResetSlowCommands();
-// for (int i = 0; i < 100000; i++)
-// {
-// db.Strings.Set(1, Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
-// }
-// var settings = db.Wait(db.Server.GetConfig("slowlog-*"));
-// var count = int.Parse(settings["slowlog-max-len"]);
-// var threshold = int.Parse(settings["slowlog-log-slower-than"]);
-
-// var ping = db.Server.Ping();
-// Assert.IsTrue(ping.Wait(10000)); // wait until inserted
-// db.Server.SaveDatabase(foreground: true);
-// var keys = db.Wait(db.Keys.Find(1, "*"));
-// var slow = db.Wait(db.Server.GetSlowCommands());
-// var slow2 = db.Wait(db.Server.GetSlowCommands(slow.Length)); // different command syntax
-// Assert.AreEqual(slow.Length, slow2.Length);
-
-
-
-// foreach(var cmd in slow)
-// {
-// Console.WriteLine(cmd.UniqueId + ": " + cmd.Duration.Milliseconds + "ms; " +
-// string.Join(", ", cmd.Arguments), cmd.GetHelpUrl());
-// Assert.IsTrue(cmd.Time > oldWhen && cmd.Time < oldWhen.AddMinutes(1));
-// }
-
-// Assert.AreEqual(2, slow.Length);
-
-// Assert.AreEqual(2, slow[0].Arguments.Length);
-// Assert.AreEqual("KEYS", slow[0].Arguments[0]);
-// Assert.AreEqual("*", slow[0].Arguments[1]);
-// Assert.AreEqual("http://redis.io/commands/keys", slow[0].GetHelpUrl());
-
-// Assert.AreEqual(1, slow[1].Arguments.Length);
-// Assert.AreEqual("SAVE", slow[1].Arguments[0]);
-// Assert.AreEqual("http://redis.io/commands/save", slow[1].GetHelpUrl());
-// }
-// }
-
-// [Test]
-// public void TestTime()
-// {
-// using (var db = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// Assert.IsNotNull(db.Features); // we waited, after all
-// if (db.Features.Time)
-// {
-// var local = DateTime.UtcNow;
-// var server = db.Wait(db.Server.Time());
-
-// Assert.True(Math.Abs((local - server).TotalMilliseconds) < 10);
-
-// }
-// }
-// }
-
-// [Test]
-// public void TestTimeWithExplicitVersion()
-// {
-// using (var db = Config.GetUnsecuredConnection(open: false))
-// {
-// db.SetServerVersion(new Version("2.6.9"), ServerType.Master);
-// db.SetKeepAlive(10);
-// Assert.IsNotNull(db.Features, "Features"); // we waited, after all
-// Assert.IsTrue(db.Features.ClientName, "ClientName");
-// Assert.IsTrue(db.Features.Time, "Time");
-// db.Name = "FooFoo";
-// db.Wait(db.Open());
-
-// var local = DateTime.UtcNow;
-// var server = db.Wait(db.Server.Time());
-
-// Assert.True(Math.Abs((local - server).TotalMilliseconds) < 10, "Latency");
-// }
-// }
-
-// [Test, ExpectedException(typeof(TimeoutException), ExpectedMessage = "The operation has timed out; the connection is not open")]
-// public void TimeoutMessageNotOpened()
-// {
-// using (var conn = Config.GetUnsecuredConnection(open: false))
-// {
-// conn.Wait(conn.Strings.Get(0, "abc"));
-// }
-// }
-
-// [Test, ExpectedException(typeof(TimeoutException), ExpectedMessage = "The operation has timed out.")]
-// public void TimeoutMessageNoDetail()
-// {
-// using (var conn = Config.GetUnsecuredConnection(open: true))
-// {
-// conn.IncludeDetailInTimeouts = false;
-// conn.Keys.Remove(0, "noexist");
-// conn.Lists.BlockingRemoveFirst(0, new[] { "noexist" }, 5);
-// conn.Wait(conn.Strings.Get(0, "abc"));
-// }
-// }
-
-// [Test, ExpectedException(typeof(TimeoutException), ExpectedMessage = "The operation has timed out; possibly blocked by: 0: BLPOP \"noexist\" 5")]
-// public void TimeoutMessageWithDetail()
-// {
-// using (var conn = Config.GetUnsecuredConnection(open: true, waitForOpen: true))
-// {
-// conn.IncludeDetailInTimeouts = true;
-// conn.Keys.Remove(0, "noexist");
-// conn.Lists.BlockingRemoveFirst(0, new[] { "noexist" }, 5);
-// conn.Wait(conn.Strings.Get(0, "abc"));
-// }
-// }
-
-// [Test]
-// public void ClientList()
-// {
-// using (var killMe = Config.GetUnsecuredConnection())
-// using (var conn = Config.GetUnsecuredConnection(allowAdmin: true))
-// {
-// killMe.Wait(killMe.Strings.GetString(7, "kill me quick"));
-// var clients = conn.Wait(conn.Server.ListClients());
-// var target = clients.Single(x => x.Database == 7);
-// conn.Wait(conn.Server.KillClient(target.Address));
-// Assert.IsTrue(clients.Length > 0);
-
-// try
-// {
-// killMe.Wait(killMe.Strings.GetString(7, "kill me quick"));
-// Assert.Fail("Should have been dead");
-// }
-// catch (Exception) { }
-// }
-// }
-
-// [Test]
-// public void HappilyMurderedClientDoesntGetError()
-// {
-// using (var victim = Config.GetUnsecuredConnection(waitForOpen: true))
-// using (var murderer = Config.GetUnsecuredConnection(allowAdmin: true))
-// {
-// const int VictimDB = 4;
-// victim.Wait(victim.Strings.GetString(VictimDB, "kill me quick"));
-// victim.CompletionMode = ResultCompletionMode.PreserveOrder;
-// var clients = murderer.Wait(murderer.Server.ListClients());
-// var target = clients.Single(x => x.Database == VictimDB);
-
-// int i = 0;
-// victim.Closed += (s, a) =>
-// {
-// Interlocked.Increment(ref i);
-// };
-// var errors = new List();
-// victim.Shutdown += (s, a) =>
-// {
-// if (a.Exception != null)
-// {
-// lock (errors)
-// {
-// errors.Add(a.Exception);
-// }
-// }
-// };
-// victim.Error += (s, a) =>
-// {
-// lock (errors)
-// {
-// errors.Add(a.Exception);
-// }
-// };
-// victim.Wait(victim.Server.Ping());
-// murderer.Wait(murderer.Server.KillClient(target.Address));
-
-// PubSub.AllowReasonableTimeToPublishAndProcess();
-
-// Assert.AreEqual(1, Interlocked.CompareExchange(ref i, 0, 0));
-// lock(errors)
-// {
-// foreach (var err in errors) Console.WriteLine(err.Message);
-// Assert.AreEqual(0, errors.Count);
-// }
-// Assert.AreEqual(ShutdownType.ServerClosed, victim.ShutdownType);
-
-
-// }
-// }
-// [Test]
-// public void MurderedClientKnowsAboutIt()
-// {
-// using (var victim = Config.GetUnsecuredConnection(waitForOpen: true))
-// using (var murderer = Config.GetUnsecuredConnection(allowAdmin: true))
-// {
-// const int VictimDB = 3;
-// victim.Wait(victim.Strings.GetString(VictimDB, "kill me quick"));
-// victim.CompletionMode = ResultCompletionMode.PreserveOrder;
-// var clients = murderer.Wait(murderer.Server.ListClients());
-// var target = clients.Single(x => x.Database == VictimDB);
-
-// object sync = new object();
-// ErrorEventArgs args = null;
-// Exception ex = null;
-// ManualResetEvent shutdownGate = new ManualResetEvent(false),
-// exGate = new ManualResetEvent(false);
-// victim.Shutdown += (s,a) =>
-// {
-// Console.WriteLine("shutdown");
-// Interlocked.Exchange(ref args, a);
-// shutdownGate.Set();
-// };
-// lock (sync)
-// {
-// ThreadPool.QueueUserWorkItem(x =>
-// {
-// try
-// {
-
-// for (int i = 0; i < 50000; i++)
-// {
-// if (i == 5) lock (sync) { Monitor.PulseAll(sync); }
-// victim.Wait(victim.Strings.Set(VictimDB, "foo", "foo"));
-// }
-// }
-// catch(Exception ex2)
-// {
-// Console.WriteLine("ex");
-// Interlocked.Exchange(ref ex, ex2);
-// exGate.Set();
-// }
-// }, null);
-// // want the other thread to be running
-// Monitor.Wait(sync);
-// Console.WriteLine("got pulse; victim is ready");
-// }
-
-// Console.WriteLine("killing " + target.Address);
-// murderer.Wait(murderer.Server.KillClient(target.Address));
-
-// Console.WriteLine("waiting on gates...");
-// Assert.IsTrue(shutdownGate.WaitOne(10000), "shutdown gate");
-// Assert.IsTrue(exGate.WaitOne(10000), "exception gate");
-// Console.WriteLine("gates passed");
-
-// Assert.AreEqual(ShutdownType.ServerClosed, victim.ShutdownType);
-// var args_final = Interlocked.Exchange(ref args, null);
-// var ex_final = Interlocked.Exchange(ref ex, null);
-// Assert.IsNotNull(ex_final, "ex");
-// Assert.IsNotNull(args_final, "args");
-// }
-// }
-
-// [Test]
-// public void CleanCloseKnowsReason()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// conn.Wait(conn.Server.Ping());
-// conn.Close(false);
-// Assert.AreEqual(ShutdownType.ClientClosed, conn.ShutdownType);
-// }
-// }
-// [Test]
-// public void DisposeKnowsReason()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// conn.Wait(conn.Server.Ping());
-// conn.Dispose();
-// Assert.AreEqual(ShutdownType.ClientDisposed, conn.ShutdownType);
-// }
-// }
-
-// [Test]
-// public void TestLastSentCounter()
-// {
-// using (var db = Config.GetUnsecuredConnection(open: false))
-// {
-// db.SetServerVersion(new Version("2.6.0"), ServerType.Master);
-// db.SetKeepAlive(0); // turn off keep-alives so we don't get unexpected pings
-
-// db.Wait(db.Open());
-// db.Wait(db.Server.Ping());
-// var first = db.GetCounters(false);
-// Assert.LessOrEqual(0, 1, "0 <= 1");
-// Assert.LessOrEqual(first.LastSentMillisecondsAgo, 100, "first");
-
-// Thread.Sleep(2000);
-// var second = db.GetCounters(false);
-// Assert.GreaterOrEqual(1, 0, "1 >= 0");
-// Assert.GreaterOrEqual(second.LastSentMillisecondsAgo, 1900, "second");
-// Assert.LessOrEqual(second.LastSentMillisecondsAgo, 2100, "second");
-
-// db.Wait(db.Server.Ping());
-// var third = db.GetCounters(false);
-// Assert.LessOrEqual(0, 1, "0 <= 1");
-// Assert.LessOrEqual(third.LastSentMillisecondsAgo, 100, "third");
-// }
-// }
-
-// [Test]
-// public void TestKeepAlive()
-// {
-// string oldValue = null;
-// try
-// {
-// using (var db = Config.GetUnsecuredConnection(allowAdmin: true))
-// {
-// oldValue = db.Wait(db.Server.GetConfig("timeout")).Single().Value;
-// db.Server.SetConfig("timeout", "20");
-// }
-// using (var db = Config.GetUnsecuredConnection(allowAdmin: false, waitForOpen:true))
-// {
-// var before = db.GetCounters(false);
-// Assert.AreEqual(4, before.KeepAliveSeconds, "keep-alive");
-// Thread.Sleep(13 * 1000);
-// var after = db.GetCounters(false);
-// // 3 here is 2 * keep-alive, and one PING in GetCounters()
-// int sent = after.MessagesSent - before.MessagesSent;
-// Assert.GreaterOrEqual(1, 0);
-// Assert.GreaterOrEqual(sent, 3);
-// Assert.LessOrEqual(0, 4);
-// Assert.LessOrEqual(sent, 4);
-// }
-// }
-// finally
-// {
-// if (oldValue != null)
-// {
-// Task t;
-// using (var db = Config.GetUnsecuredConnection(allowAdmin: true))
-// {
-// t = db.Server.SetConfig("timeout", oldValue);
-// }
-// Assert.IsTrue(t.Wait(5000));
-// if (t.Exception != null) throw t.Exception;
-// }
-// }
-// }
-
-// [Test, ActiveTest]
-// public void SetValueWhileDisposing()
-// {
-// const int LOOP = 10;
-// for (int i = 0; i < LOOP; i++)
-// {
-// var guid = Config.CreateUniqueName();
-// Task t1, t3;
-// Task t2;
-// string key = "SetValueWhileDisposing:" + i;
-// using (var db = Config.GetUnsecuredConnection(open: true))
-// {
-// t1 = db.Strings.Set(0, key, guid);
-// }
-// Assert.IsTrue(t1.Wait(500));
-// using (var db = Config.GetUnsecuredConnection())
-// {
-// t2 = db.Strings.GetString(0, key);
-// t3 = db.Keys.Remove(0, key);
-// }
-// Assert.IsTrue(t2.Wait(500));
-// Assert.AreEqual(guid, t2.Result);
-// Assert.IsTrue(t3.Wait(500));
-// }
-// }
-
-// [Test]
-// public void TestMasterSlaveSetup()
-// {
-// using (var unsec = Config.GetUnsecuredConnection(true, true, true))
-// using (var sec = Config.GetUnsecuredConnection(true, true, true))
-// {
-// try
-// {
-// var makeSlave = sec.Server.MakeSlave(unsec.Host, unsec.Port);
-// var info = sec.Wait(sec.Server.GetInfo());
-// sec.Wait(makeSlave);
-// Assert.AreEqual("slave", info["role"], "slave");
-// Assert.AreEqual(unsec.Host, info["master_host"], "host");
-// Assert.AreEqual(unsec.Port.ToString(), info["master_port"], "port");
-// var makeMaster = sec.Server.MakeMaster();
-// info = sec.Wait(sec.Server.GetInfo());
-// sec.Wait(makeMaster);
-// Assert.AreEqual("master", info["role"], "master");
-// }
-// finally
-// {
-// sec.Server.MakeMaster();
-// }
-
-// }
-// }
-// }
-//}
diff --git a/MigratedBookSleeveTestSuite/Sets.cs b/MigratedBookSleeveTestSuite/Sets.cs
deleted file mode 100644
index 37fc64b65..000000000
--- a/MigratedBookSleeveTestSuite/Sets.cs
+++ /dev/null
@@ -1,513 +0,0 @@
-//using System;
-//using NUnit.Framework;
-//using System.Text;
-//using System.Linq;
-//namespace Tests
-//{
-// [TestFixture]
-// public class Sets // http://redis.io/commands#set
-// {
-// [Test]
-// public void AddSingle()
-// {
-// using(var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "set");
-// var r0 = conn.Sets.Add(3, "set", "abc");
-// var r1 = conn.Sets.Add(3, "set", "abc");
-// var len = conn.Sets.GetLength(3, "set");
-
-// Assert.AreEqual(true, r0.Result);
-// Assert.AreEqual(false, r1.Result);
-// Assert.AreEqual(1, len.Result);
-// }
-// }
-// [Test]
-// public void Scan()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// if (!conn.Features.Scan) Assert.Inconclusive();
-
-// const int db = 3;
-// const string key = "set-scan";
-// conn.Keys.Remove(db, key);
-// conn.Sets.Add(db, key, "abc");
-// conn.Sets.Add(db, key, "def");
-// conn.Sets.Add(db, key, "ghi");
-
-// var t1 = conn.Sets.Scan(db, key);
-// var t3 = conn.Sets.ScanString(db, key);
-// var t4 = conn.Sets.ScanString(db, key, "*h*");
-
-// var v1 = t1.ToArray();
-// var v3 = t3.ToArray();
-// var v4 = t4.ToArray();
-
-// Assert.AreEqual(3, v1.Length);
-// Assert.AreEqual(3, v3.Length);
-// Assert.AreEqual(1, v4.Length);
-// Array.Sort(v1, (x, y) => string.Compare(Encoding.UTF8.GetString(x), Encoding.UTF8.GetString(y)));
-// Array.Sort(v3);
-// Array.Sort(v4);
-
-// Assert.AreEqual("abc,def,ghi", string.Join(",", v1.Select(x => Encoding.UTF8.GetString(x))));
-// Assert.AreEqual("abc,def,ghi", string.Join(",", v3));
-// Assert.AreEqual("ghi", string.Join(",", v4));
-// }
-// }
-// [Test]
-// public void AddSingleBinary()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "set");
-// var r0 = conn.Sets.Add(3, "set", Encode("abc"));
-// var r1 = conn.Sets.Add(3, "set", Encode("abc"));
-// var len = conn.Sets.GetLength(3, "set");
-
-// Assert.AreEqual(true, r0.Result);
-// Assert.AreEqual(false, r1.Result);
-// Assert.AreEqual(1, len.Result);
-// }
-// }
-// static byte[] Encode(string value) { return Encoding.UTF8.GetBytes(value); }
-// static string Decode(byte[] value) { return Encoding.UTF8.GetString(value); }
-// [Test]
-// public void RemoveSingle()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "set");
-// conn.Sets.Add(3, "set", "abc");
-// conn.Sets.Add(3, "set", "def");
-
-// var r0 = conn.Sets.Remove(3, "set", "abc");
-// var r1 = conn.Sets.Remove(3, "set", "abc");
-// var len = conn.Sets.GetLength(3, "set");
-
-// Assert.AreEqual(true, r0.Result);
-// Assert.AreEqual(false, r1.Result);
-// Assert.AreEqual(1, len.Result);
-// }
-// }
-
-// [Test]
-// public void RemoveSingleBinary()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "set");
-// conn.Sets.Add(3, "set", Encode("abc"));
-// conn.Sets.Add(3, "set", Encode("def"));
-
-// var r0 = conn.Sets.Remove(3, "set", Encode("abc"));
-// var r1 = conn.Sets.Remove(3, "set", Encode("abc"));
-// var len = conn.Sets.GetLength(3, "set");
-
-// Assert.AreEqual(true, r0.Result);
-// Assert.AreEqual(false, r1.Result);
-// Assert.AreEqual(1, len.Result);
-// }
-// }
-
-// [Test]
-// public void AddMulti()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// conn.Keys.Remove(3, "set");
-// var r0 = conn.Sets.Add(3, "set", "abc");
-// var r1 = conn.Sets.Add(3, "set", new[] {"abc", "def"});
-// var len = conn.Sets.GetLength(3, "set");
-
-// Assert.AreEqual(true, r0.Result);
-// Assert.AreEqual(1, r1.Result);
-// Assert.AreEqual(2, len.Result);
-// }
-// }
-
-// [Test]
-// public void RemoveMulti()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// conn.Keys.Remove(3, "set");
-// conn.Sets.Add(3, "set", "abc");
-// conn.Sets.Add(3, "set", "ghi");
-
-// var r0 = conn.Sets.Remove(3, "set", new[] {"abc", "def"});
-// var len = conn.Sets.GetLength(3, "set");
-
-// Assert.AreEqual(1, r0.Result);
-// Assert.AreEqual(1, len.Result);
-// }
-// }
-
-// [Test]
-// public void AddMultiBinary()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen:true))
-// {
-// conn.Keys.Remove(3, "set");
-// var r0 = conn.Sets.Add(3, "set", Encode("abc"));
-// var r1 = conn.Sets.Add(3, "set", new[] { Encode("abc"), Encode("def") });
-// var len = conn.Sets.GetLength(3, "set");
-
-// Assert.AreEqual(true, r0.Result);
-// Assert.AreEqual(1, r1.Result);
-// Assert.AreEqual(2, len.Result);
-// }
-// }
-
-// [Test]
-// public void RemoveMultiBinary()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// conn.Keys.Remove(3, "set");
-// conn.Sets.Add(3, "set", Encode("abc"));
-// conn.Sets.Add(3, "set", Encode("ghi"));
-
-// var r0 = conn.Sets.Remove(3, "set", new[] { Encode("abc"), Encode("def") });
-// var len = conn.Sets.GetLength(3, "set");
-
-// Assert.AreEqual(1, r0.Result);
-// Assert.AreEqual(1, len.Result);
-// }
-// }
-
-// [Test]
-// public void Exists()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "set");
-// var r0 = conn.Sets.Contains(3, "set", "def");
-
-// conn.Sets.Add(3, "set", "abc");
-// var r1 = conn.Sets.Contains(3, "set", "def");
-
-// conn.Sets.Add(3, "set", "def");
-// var r2 = conn.Sets.Contains(3, "set", "def");
-
-// conn.Sets.Remove(3, "set", "def");
-// var r3 = conn.Sets.Contains(3, "set", "def");
-
-// Assert.AreEqual(false, r0.Result);
-// Assert.AreEqual(false, r1.Result);
-// Assert.AreEqual(true, r2.Result);
-// Assert.AreEqual(false, r3.Result);
-// }
-// }
-
-
-// [Test]
-// public void ExistsBinary()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "set");
-// var r0 = conn.Sets.Contains(3, "set", Encode("def"));
-
-// conn.Sets.Add(3, "set", "abc");
-// var r1 = conn.Sets.Contains(3, "set", Encode("def"));
-
-// conn.Sets.Add(3, "set", "def");
-// var r2 = conn.Sets.Contains(3, "set", Encode("def"));
-
-// conn.Sets.Remove(3, "set", "def");
-// var r3 = conn.Sets.Contains(3, "set", Encode("def"));
-
-// Assert.AreEqual(false, r0.Result);
-// Assert.AreEqual(false, r1.Result);
-// Assert.AreEqual(true, r2.Result);
-// Assert.AreEqual(false, r3.Result);
-// }
-// }
-
-// [Test]
-// public void GetRandom()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "set");
-
-// Assert.IsNull(conn.Sets.GetRandomString(3, "set").Result);
-// Assert.IsNull(conn.Sets.GetRandom(3, "set").Result);
-
-// conn.Sets.Add(3, "set", "abc");
-// Assert.AreEqual("abc", conn.Sets.GetRandomString(3, "set").Result);
-// Assert.AreEqual("abc", Decode(conn.Sets.GetRandom(3, "set").Result));
-
-// conn.Sets.Add(3, "set", Encode("def"));
-// var result = conn.Sets.GetRandomString(3, "set").Result;
-// Assert.IsTrue(result == "abc" || result == "def");
-// result = Decode(conn.Sets.GetRandom(3, "set").Result);
-// Assert.IsTrue(result == "abc" || result == "def");
-// }
-// }
-
-// [Test]
-// public void GetRandomMulti()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// if (conn.Features.MultipleRandom)
-// {
-// conn.Keys.Remove(3, "set");
-
-// Assert.AreEqual(0, conn.Sets.GetRandomString(3, "set", 2).Result.Length);
-// Assert.AreEqual(0, conn.Sets.GetRandom(3, "set", 2).Result.Length);
-
-// conn.Sets.Add(3, "set", "abc");
-// var a1 = conn.Sets.GetRandomString(3, "set", 2).Result;
-// var a2 = conn.Sets.GetRandom(3, "set", 2).Result;
-// Assert.AreEqual(1, a1.Length);
-// Assert.AreEqual(1, a2.Length);
-// Assert.AreEqual("abc", a1[0]);
-// Assert.AreEqual("abc", Decode(a2[0]));
-
-// conn.Sets.Add(3, "set", Encode("def"));
-// var a3 = conn.Sets.GetRandomString(3, "set", 3).Result;
-// var a4 = Array.ConvertAll(conn.Sets.GetRandom(3, "set", 3).Result, Decode);
-
-// Assert.AreEqual(2, a3.Length);
-// Assert.AreEqual(2, a4.Length);
-// Assert.Contains("abc", a3);
-// Assert.Contains("def", a3);
-// Assert.Contains("abc", a4);
-// Assert.Contains("def", a4);
-
-// var a5 = conn.Sets.GetRandomString(3, "set", -3).Result;
-// var a6 = Array.ConvertAll(conn.Sets.GetRandom(3, "set", -3).Result, Decode);
-// Assert.AreEqual(3, a5.Length);
-// Assert.AreEqual(3, a6.Length);
-// Assert.IsTrue(a5.All(x => x == "abc" || x == "def"));
-// Assert.IsTrue(a6.All(x => x == "abc" || x == "def"));
-// }
-// }
-// }
-
-// [Test]
-// public void RemoveRandom()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "set");
-
-// Assert.IsNull(conn.Sets.RemoveRandomString(3, "set").Result);
-// Assert.IsNull(conn.Sets.RemoveRandom(3, "set").Result);
-
-// conn.Sets.Add(3, "set", "abc");
-// Assert.AreEqual("abc", conn.Sets.RemoveRandomString(3, "set").Result);
-// Assert.AreEqual(0, conn.Sets.GetLength(3, "set").Result);
-
-// conn.Sets.Add(3, "set", "abc");
-// Assert.AreEqual("abc", Decode(conn.Sets.RemoveRandom(3, "set").Result));
-// Assert.AreEqual(0, conn.Sets.GetLength(3, "set").Result);
-
-// conn.Sets.Add(3, "set", "abc");
-// conn.Sets.Add(3, "set", Encode("def"));
-// var result1 = conn.Sets.RemoveRandomString(3, "set").Result;
-// var result2 = Decode(conn.Sets.RemoveRandom(3, "set").Result);
-// Assert.AreEqual(0, conn.Sets.GetLength(3, "set").Result);
-
-// Assert.AreNotEqual(result1, result2);
-// Assert.IsTrue(result1 == "abc" || result1 == "def");
-// Assert.IsTrue(result2 == "abc" || result2 == "def");
-// }
-// }
-
-// [Test]
-// public void GetAll()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "set");
-
-// var b0 = conn.Sets.GetAll(3, "set");
-// var s0 = conn.Sets.GetAllString(3, "set");
-// conn.Sets.Add(3, "set", "abc");
-// conn.Sets.Add(3, "set", "def");
-// var b1 = conn.Sets.GetAll(3, "set");
-// var s1 = conn.Sets.GetAllString(3, "set");
-
-// Assert.AreEqual(0, conn.Wait(b0).Length);
-// Assert.AreEqual(0, conn.Wait(s0).Length);
-// // check strings
-// var s = conn.Wait(s1);
-// Assert.AreEqual(2, s.Length);
-// Array.Sort(s);
-// Assert.AreEqual("abc", s[0]);
-// Assert.AreEqual("def", s[1]);
-// // check binary
-// s = Array.ConvertAll(conn.Wait(b1), Decode);
-// Assert.AreEqual(2, s.Length);
-// Array.Sort(s);
-// Assert.AreEqual("abc", s[0]);
-// Assert.AreEqual("def", s[1]);
-// }
-// }
-
-// [Test]
-// public void Move()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "from");
-// conn.Keys.Remove(3, "to");
-// conn.Sets.Add(3, "from", "abc");
-// conn.Sets.Add(3, "from", "def");
-
-// Assert.AreEqual(2, conn.Sets.GetLength(3, "from").Result);
-// Assert.AreEqual(0, conn.Sets.GetLength(3, "to").Result);
-
-// Assert.IsFalse(conn.Sets.Move(3, "from", "to", "nix").Result);
-// Assert.IsFalse(conn.Sets.Move(3, "from", "to", Encode("nix")).Result);
-
-// Assert.IsTrue(conn.Sets.Move(3, "from", "to", "abc").Result);
-// Assert.IsTrue(conn.Sets.Move(3, "from", "to", Encode("def")).Result);
-
-// Assert.AreEqual(0, conn.Sets.GetLength(3, "from").Result);
-// Assert.AreEqual(2, conn.Sets.GetLength(3, "to").Result);
-// }
-// }
-
-// [Test]
-// public void Diff()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "key1");
-// conn.Keys.Remove(3, "key2");
-// conn.Keys.Remove(3, "key3");
-// conn.Keys.Remove(3, "to");
-// conn.Sets.Add(3, "key1", "a");
-// conn.Sets.Add(3, "key1", "b");
-// conn.Sets.Add(3, "key1", "c");
-// conn.Sets.Add(3, "key1", "d");
-// conn.Sets.Add(3, "key2", "c");
-// conn.Sets.Add(3, "key3", "a");
-// conn.Sets.Add(3, "key3", "c");
-// conn.Sets.Add(3, "key3", "e");
-
-// var diff1 = conn.Sets.Difference(3, new[] {"key1", "key2", "key3"});
-// var diff2 = conn.Sets.DifferenceString(3, new[] { "key1", "key2", "key3" });
-// var len = conn.Sets.DifferenceAndStore(3, "to", new[] { "key1", "key2", "key3" });
-// var diff3 = conn.Sets.GetAllString(3, "to");
-
-// var s = Array.ConvertAll(conn.Wait(diff1), Decode);
-// Assert.AreEqual(2, s.Length);
-// Array.Sort(s);
-// Assert.AreEqual("b", s[0]);
-// Assert.AreEqual("d", s[1]);
-
-// s = conn.Wait(diff2);
-// Assert.AreEqual(2, s.Length);
-// Array.Sort(s);
-// Assert.AreEqual("b", s[0]);
-// Assert.AreEqual("d", s[1]);
-
-// Assert.AreEqual(2, conn.Wait(len));
-// s = conn.Wait(diff3);
-// Assert.AreEqual(2, s.Length);
-// Array.Sort(s);
-// Assert.AreEqual("b", s[0]);
-// Assert.AreEqual("d", s[1]);
-// }
-// }
-
-
-// [Test]
-// public void Intersect()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "key1");
-// conn.Keys.Remove(3, "key2");
-// conn.Keys.Remove(3, "key3");
-// conn.Keys.Remove(3, "to");
-// conn.Sets.Add(3, "key1", "a");
-// conn.Sets.Add(3, "key1", "b");
-// conn.Sets.Add(3, "key1", "c");
-// conn.Sets.Add(3, "key1", "d");
-// conn.Sets.Add(3, "key2", "c");
-// conn.Sets.Add(3, "key3", "a");
-// conn.Sets.Add(3, "key3", "c");
-// conn.Sets.Add(3, "key3", "e");
-
-// var diff1 = conn.Sets.Intersect(3, new[] { "key1", "key2", "key3" });
-// var diff2 = conn.Sets.IntersectString(3, new[] { "key1", "key2", "key3" });
-// var len = conn.Sets.IntersectAndStore(3, "to", new[] { "key1", "key2", "key3" });
-// var diff3 = conn.Sets.GetAllString(3, "to");
-
-// var s = Array.ConvertAll(conn.Wait(diff1), Decode);
-// Assert.AreEqual(1, s.Length);
-// Assert.AreEqual("c", s[0]);
-
-// s = conn.Wait(diff2);
-// Assert.AreEqual(1, s.Length);
-// Assert.AreEqual("c", s[0]);
-
-// Assert.AreEqual(1, conn.Wait(len));
-// s = conn.Wait(diff3);
-// Assert.AreEqual(1, s.Length);
-// Assert.AreEqual("c", s[0]);
-// }
-// }
-
-// [Test]
-// public void Union()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "key1");
-// conn.Keys.Remove(3, "key2");
-// conn.Keys.Remove(3, "key3");
-// conn.Keys.Remove(3, "to");
-// conn.Sets.Add(3, "key1", "a");
-// conn.Sets.Add(3, "key1", "b");
-// conn.Sets.Add(3, "key1", "c");
-// conn.Sets.Add(3, "key1", "d");
-// conn.Sets.Add(3, "key2", "c");
-// conn.Sets.Add(3, "key3", "a");
-// conn.Sets.Add(3, "key3", "c");
-// conn.Sets.Add(3, "key3", "e");
-
-// var diff1 = conn.Sets.Union(3, new[] { "key1", "key2", "key3" });
-// var diff2 = conn.Sets.UnionString(3, new[] { "key1", "key2", "key3" });
-// var len = conn.Sets.UnionAndStore(3, "to", new[] { "key1", "key2", "key3" });
-// var diff3 = conn.Sets.GetAllString(3, "to");
-
-// var s = Array.ConvertAll(conn.Wait(diff1), Decode);
-// Assert.AreEqual(5, s.Length);
-// Array.Sort(s);
-// Assert.AreEqual("a", s[0]);
-// Assert.AreEqual("b", s[1]);
-// Assert.AreEqual("c", s[2]);
-// Assert.AreEqual("d", s[3]);
-// Assert.AreEqual("e", s[4]);
-
-// s = conn.Wait(diff2);
-// Assert.AreEqual(5, s.Length);
-// Array.Sort(s);
-// Assert.AreEqual("a", s[0]);
-// Assert.AreEqual("b", s[1]);
-// Assert.AreEqual("c", s[2]);
-// Assert.AreEqual("d", s[3]);
-// Assert.AreEqual("e", s[4]);
-
-// Assert.AreEqual(5, conn.Wait(len));
-// s = conn.Wait(diff3);
-// Assert.AreEqual(5, s.Length);
-// Array.Sort(s);
-// Assert.AreEqual("a", s[0]);
-// Assert.AreEqual("b", s[1]);
-// Assert.AreEqual("c", s[2]);
-// Assert.AreEqual("d", s[3]);
-// Assert.AreEqual("e", s[4]);
-// }
-// }
-// }
-//}
diff --git a/MigratedBookSleeveTestSuite/SortedSets.cs b/MigratedBookSleeveTestSuite/SortedSets.cs
deleted file mode 100644
index 55d40a983..000000000
--- a/MigratedBookSleeveTestSuite/SortedSets.cs
+++ /dev/null
@@ -1,376 +0,0 @@
-//using System.Linq;
-//using NUnit.Framework;
-//using System;
-//using System.Text;
-//using BookSleeve;
-//using System.Collections.Generic;
-//using System.Threading.Tasks;
-
-//namespace Tests
-//{
-// [TestFixture]
-// public class SortedSets // http://redis.io/commands#sorted_set
-// {
-// [Test]
-// public void SortedTrim()
-// {
-// using(var conn = Config.GetUnsecuredConnection())
-// {
-// const int db = 0;
-// const string key = "sorted-trim";
-// for(int i = 0; i < 200; i++)
-// {
-// conn.SortedSets.Add(db, key, i.ToString(), i);
-// }
-// conn.SortedSets.RemoveRange(db, key, 0, -21);
-// var count = conn.SortedSets.GetLength(db, key);
-// Assert.AreEqual(20, conn.Wait(count));
-// }
-// }
-
-// [Test]
-// public void Scan()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen:true))
-// {
-// if (!conn.Features.Scan) Assert.Inconclusive();
-
-// const int db = 3;
-// const string key = "sorted-set-scan";
-// conn.Keys.Remove(db, key);
-// conn.SortedSets.Add(db, key, "abc", 1);
-// conn.SortedSets.Add(db, key, "def", 2);
-// conn.SortedSets.Add(db, key, "ghi", 3);
-
-// var t1 = conn.SortedSets.Scan(db, key);
-// var t3 = conn.SortedSets.ScanString(db, key);
-// var t4 = conn.SortedSets.ScanString(db, key, "*h*");
-
-// var v1 = t1.ToArray();
-// var v3 = t3.ToArray();
-// var v4 = t4.ToArray();
-
-// Assert.AreEqual(3, v1.Length);
-// Assert.AreEqual(3, v3.Length);
-// Assert.AreEqual(1, v4.Length);
-// Array.Sort(v1, (x, y) => string.Compare(Encoding.UTF8.GetString(x.Key), Encoding.UTF8.GetString(y.Key)));
-// Array.Sort(v3, (x, y) => string.Compare(x.Key, y.Key));
-// Array.Sort(v4, (x, y) => string.Compare(x.Key, y.Key));
-
-// Assert.AreEqual("abc=1,def=2,ghi=3", string.Join(",", v1.Select(pair => Encoding.UTF8.GetString(pair.Key) + "=" + pair.Value)));
-// Assert.AreEqual("abc=1,def=2,ghi=3", string.Join(",", v3.Select(pair => pair.Key + "=" + pair.Value)));
-// Assert.AreEqual("ghi=3", string.Join(",", v4.Select(pair => pair.Key + "=" + pair.Value)));
-// }
-// }
-// [Test]
-// public void Range() // http://code.google.com/p/booksleeve/issues/detail?id=12
-// {
-// using(var conn = Config.GetUnsecuredConnection())
-// {
-// const double value = 634614442154715;
-// conn.SortedSets.Add(3, "zset", "abc", value);
-// var range = conn.SortedSets.Range(3, "zset", 0, -1);
-
-// Assert.AreEqual(value, conn.Wait(range).Single().Value);
-// }
-// }
-// [Test]
-// public void RangeString() // http://code.google.com/p/booksleeve/issues/detail?id=18
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// const double value = 634614442154715;
-// conn.SortedSets.Add(3, "zset", "abc", value);
-// var range = conn.SortedSets.RangeString(3, "zset", 0, -1);
-
-// Assert.AreEqual(value, conn.Wait(range).Single().Value);
-// }
-// }
-
-// [Test]
-// public void Score() // http://code.google.com/p/booksleeve/issues/detail?id=23
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(0, "abc");
-// conn.SortedSets.Add(0, "abc", "def", 1.0);
-// var s1 = conn.SortedSets.Score(0, "abc", "def");
-// var s2 = conn.SortedSets.Score(0, "abc", "ghi");
-
-// Assert.AreEqual(1.0, conn.Wait(s1));
-// Assert.IsNull(conn.Wait(s2));
-// }
-// }
-
-// [Test]
-// public void Rank() // http://code.google.com/p/booksleeve/issues/detail?id=23
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(0, "abc");
-// conn.SortedSets.Add(0, "abc", "def", 1.0);
-// conn.SortedSets.Add(0, "abc", "jkl", 2.0);
-// var a1 = conn.SortedSets.Rank(0, "abc", "def", ascending: true);
-// var a2 = conn.SortedSets.Rank(0, "abc", "ghi", ascending: true);
-// var a3 = conn.SortedSets.Rank(0, "abc", "jkl", ascending: true);
-
-// var d1 = conn.SortedSets.Rank(0, "abc", "def", ascending: false);
-// var d2 = conn.SortedSets.Rank(0, "abc", "ghi", ascending: false);
-// var d3 = conn.SortedSets.Rank(0, "abc", "jkl", ascending: false);
-
-// Assert.AreEqual(0, conn.Wait(a1));
-// Assert.IsNull(conn.Wait(a2));
-// Assert.AreEqual(1, conn.Wait(a3));
-
-// Assert.AreEqual(1, conn.Wait(d1));
-// Assert.IsNull(conn.Wait(d2));
-// Assert.AreEqual(0, conn.Wait(d3));
-// }
-// }
-
-// static string SeedRange(RedisConnection connection, out double min, out double max)
-// {
-// var rand = new Random(123456);
-// const string key = "somerange";
-// connection.Keys.Remove(0, key);
-// min = max = 0;
-// for (int i = 0; i < 50; i++)
-// {
-// double value = rand.NextDouble();
-// if (i == 0)
-// {
-// min = max = value;
-// }
-// else
-// {
-// if (value < min) min = value;
-// if (value > max) max= value;
-// }
-// connection.SortedSets.Add(0, key, "item " + i, value);
-// }
-// return key;
-// }
-// [Test]
-// public void GetAll()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// double minActual, maxActual;
-// string key = SeedRange(conn, out minActual, out maxActual);
-
-// var all = conn.Wait(conn.SortedSets.Range(0, key, 0.0, 1.0));
-// Assert.AreEqual(50, all.Length, "all between 0.0 and 1.0");
-
-// var subset = conn.Wait(conn.SortedSets.Range(0, key, 0.0, 1.0, offset: 2, count: 46));
-// Assert.AreEqual(46, subset.Length);
-
-// var subVals = new HashSet(subset.Select(x => x.Value));
-
-// Assert.IsFalse(subVals.Contains(all[0].Value));
-// Assert.IsFalse(subVals.Contains(all[1].Value));
-// Assert.IsFalse(subVals.Contains(all[48].Value));
-// Assert.IsFalse(subVals.Contains(all[49].Value));
-// for (int i = 2; i < 48; i++)
-// {
-// Assert.IsTrue(subVals.Contains(all[i].Value));
-// }
-// }
-// }
-
-// [Test]
-// public void FindMinMax()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// double minActual, maxActual;
-// string key = SeedRange(conn, out minActual, out maxActual);
-
-// var min = conn.SortedSets.Range(0, key, ascending: true, count: 1);
-// var max = conn.SortedSets.Range(0, key, ascending: false, count: 1);
-
-// var minScore = conn.Wait(min).Single().Value;
-// var maxScore = conn.Wait(max).Single().Value;
-
-// Assert.Less(1, 2); // I *always* get these args the wrong way around
-// Assert.Less(Math.Abs(minActual - minScore), 0.0000001, "min");
-// Assert.Less(Math.Abs(maxActual - maxScore), 0.0000001, "max");
-// }
-// }
-
-// [Test]
-// public void CheckInfinity()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(0, "infs");
-// conn.SortedSets.Add(0, "infs", "neg", double.NegativeInfinity);
-// conn.SortedSets.Add(0, "infs", "pos", double.PositiveInfinity);
-// conn.SortedSets.Add(0, "infs", "zero", 0.0);
-// var pairs = conn.Wait(conn.SortedSets.RangeString(0, "infs", 0, -1));
-// Assert.AreEqual(3, pairs.Length);
-// Assert.AreEqual("neg", pairs[0].Key);
-// Assert.AreEqual("zero", pairs[1].Key);
-// Assert.AreEqual("pos", pairs[2].Key);
-// Assert.IsTrue(double.IsNegativeInfinity(pairs[0].Value), "-inf");
-// Assert.AreEqual(0.0, pairs[1].Value);
-// Assert.IsTrue(double.IsPositiveInfinity(pairs[2].Value), "+inf");
-// }
-// }
-
-// [Test]
-// public void UnionAndStore()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "key1");
-// conn.Keys.Remove(3, "key2");
-// conn.Keys.Remove(3, "to");
-
-// conn.SortedSets.Add(3, "key1", "a", 1);
-// conn.SortedSets.Add(3, "key1", "b", 2);
-// conn.SortedSets.Add(3, "key1", "c", 3);
-
-// conn.SortedSets.Add(3, "key2", "a", 1);
-// conn.SortedSets.Add(3, "key2", "b", 2);
-// conn.SortedSets.Add(3, "key2", "c", 3);
-
-// var numberOfElementsT = conn.SortedSets.UnionAndStore(3, "to", new string[] { "key1", "key2" }, BookSleeve.RedisAggregate.Sum);
-// var resultSetT = conn.SortedSets.RangeString(3, "to", 0, -1);
-
-// var numberOfElements = conn.Wait(numberOfElementsT);
-// Assert.AreEqual(3, numberOfElements);
-
-// var s = conn.Wait(resultSetT);
-
-// Assert.AreEqual("a", s[0].Key);
-// Assert.AreEqual("b", s[1].Key);
-// Assert.AreEqual("c", s[2].Key);
-
-// Assert.AreEqual(2, s[0].Value);
-// Assert.AreEqual(4, s[1].Value);
-// Assert.AreEqual(6, s[2].Value);
-// }
-// }
-
-// [Test]
-// public void UnionAndStoreMax()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "key1");
-// conn.Keys.Remove(3, "key2");
-// conn.Keys.Remove(3, "to");
-
-// conn.SortedSets.Add(3, "key1", "a", 1);
-// conn.SortedSets.Add(3, "key1", "b", 2);
-// conn.SortedSets.Add(3, "key1", "c", 3);
-
-// conn.SortedSets.Add(3, "key2", "a", 4);
-// conn.SortedSets.Add(3, "key2", "b", 5);
-// conn.SortedSets.Add(3, "key2", "c", 6);
-
-// var numberOfElementsT = conn.SortedSets.UnionAndStore(3, "to", new string[] { "key1", "key2" }, BookSleeve.RedisAggregate.Max);
-// var resultSetT = conn.SortedSets.RangeString(3, "to", 0, -1);
-
-// var numberOfElements = conn.Wait(numberOfElementsT);
-// Assert.AreEqual(3, numberOfElements);
-
-// var s = conn.Wait(resultSetT);
-
-// Assert.AreEqual("a", s[0].Key);
-// Assert.AreEqual("b", s[1].Key);
-// Assert.AreEqual("c", s[2].Key);
-
-// Assert.AreEqual(4, s[0].Value);
-// Assert.AreEqual(5, s[1].Value);
-// Assert.AreEqual(6, s[2].Value);
-// }
-// }
-
-// [Test]
-// public void UnionAndStoreMin()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(3, "key1");
-// conn.Keys.Remove(3, "key2");
-// conn.Keys.Remove(3, "to");
-
-// conn.SortedSets.Add(3, "key1", "a", 1);
-// conn.SortedSets.Add(3, "key1", "b", 2);
-// conn.SortedSets.Add(3, "key1", "c", 3);
-
-// conn.SortedSets.Add(3, "key2", "a", 4);
-// conn.SortedSets.Add(3, "key2", "b", 5);
-// conn.SortedSets.Add(3, "key2", "c", 6);
-
-// var numberOfElementsT = conn.SortedSets.UnionAndStore(3, "to", new string[] { "key1", "key2" }, BookSleeve.RedisAggregate.Min);
-// var resultSetT = conn.SortedSets.RangeString(3, "to", 0, -1);
-
-// var numberOfElements = conn.Wait(numberOfElementsT);
-// Assert.AreEqual(3, numberOfElements);
-
-// var s = conn.Wait(resultSetT);
-
-// Assert.AreEqual("a", s[0].Key);
-// Assert.AreEqual("b", s[1].Key);
-// Assert.AreEqual("c", s[2].Key);
-
-// Assert.AreEqual(1, s[0].Value);
-// Assert.AreEqual(2, s[1].Value);
-// Assert.AreEqual(3, s[2].Value);
-// }
-// }
-
-// [Test]
-// public void TestZUNIONSTORElimit()
-// {
-// const int SIZE = 10000;
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// for (int i = 0; i < SIZE; i++)
-// {
-// string key = "z_" + i;
-// conn.Keys.Remove(0, key);
-// for (int j = 0; j < 5; j++)
-// conn.SortedSets.Add(0, key, "s" + j.ToString(), j);
-// }
-// conn.Wait(conn.Server.Ping());
-
-// List results = new List(SIZE);
-// for (int i = 0; i < SIZE; i+=100)
-// {
-// string[] keys = Enumerable.Range(0,i+1).Select(x => "z_" + x).ToArray();
-// results.Add(conn.SortedSets.UnionAndStore(0, "zu_" + i, keys, RedisAggregate.Max));
-// }
-// foreach (var task in results)
-// conn.WaitAll(task);
-// }
-// }
-
-// [Test]
-// public void SO14991819()
-// {
-// const int _db = 0;
-// const string _thisChannel = "SO14991819";
-// string thisChannel = string.Format("urn:{0}", _thisChannel);
-// const string message = "hi";
-// using (var _connection = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// _connection.Keys.Remove(_db, thisChannel); // start from known state
-
-// TimeSpan span = DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1, 0, 0, 0));
-// double val = span.TotalSeconds;
-
-// _connection.SortedSets.Add(_db, thisChannel, message, val, false);
-
-// var subset = _connection.Wait(_connection.SortedSets.RangeString(
-// _db, thisChannel, span.TotalSeconds - 10000, span.TotalSeconds, offset: 0, count: 50));
-
-// Assert.AreEqual(1, subset.Length);
-// Config.AssertNearlyEqual(val, subset[0].Value);
-// Assert.AreEqual(message, subset[0].Key);
-// }
-// }
-// }
-//}
diff --git a/MigratedBookSleeveTestSuite/Strings.cs b/MigratedBookSleeveTestSuite/Strings.cs
deleted file mode 100644
index 0674f2a7f..000000000
--- a/MigratedBookSleeveTestSuite/Strings.cs
+++ /dev/null
@@ -1,253 +0,0 @@
-using System.Linq;
-using System.Text;
-using NUnit.Framework;
-using StackExchange.Redis;
-
-namespace Tests
-{
- [TestFixture]
- public class Strings // http://redis.io/commands#string
- {
- [Test]
- public void Append()
- {
- using (var muxer = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- var conn = muxer.GetDatabase(2);
- var server = Config.GetServer(muxer);
- conn.KeyDelete("append");
- var l0 = server.Features.StringLength ? conn.StringLengthAsync("append") : null;
-
- var s0 = conn.StringGetAsync("append");
-
- conn.StringSetAsync("append", "abc");
- var s1 = conn.StringGetAsync("append");
- var l1 = server.Features.StringLength ? conn.StringLengthAsync("append") : null;
-
- var result = conn.StringAppendAsync("append", Encode("defgh"));
- var s3 = conn.StringGetAsync("append");
- var l2 = server.Features.StringLength ? conn.StringLengthAsync("append") : null;
-
- Assert.AreEqual(null, (string)conn.Wait(s0));
- Assert.AreEqual("abc", (string)conn.Wait(s1));
- Assert.AreEqual(8, conn.Wait(result));
- Assert.AreEqual("abcdefgh", (string)conn.Wait(s3));
-
- if (server.Features.StringLength)
- {
- Assert.AreEqual(0, conn.Wait(l0));
- Assert.AreEqual(3, conn.Wait(l1));
- Assert.AreEqual(8, conn.Wait(l2));
- }
- }
- }
- [Test]
- public void Set()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(2);
- conn.KeyDeleteAsync("set");
-
- conn.StringSetAsync("set", "abc");
- var v1 = conn.StringGetAsync("set");
-
- conn.StringSetAsync("set", Encode("def"));
- var v2 = conn.StringGetAsync("set");
-
- Assert.AreEqual("abc", (string)conn.Wait(v1));
- Assert.AreEqual("def", (string)Decode(conn.Wait(v2)));
- }
- }
-
- [Test]
- public void SetNotExists()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(2);
- conn.KeyDeleteAsync("set");
- conn.KeyDeleteAsync("set2");
- conn.KeyDeleteAsync("set3");
- conn.StringSetAsync("set", "abc");
-
- var x0 = conn.StringSetAsync("set", "def", when: When.NotExists);
- var x1 = conn.StringSetAsync("set", Encode("def"), when: When.NotExists);
- var x2 = conn.StringSetAsync("set2", "def", when: When.NotExists);
- var x3 = conn.StringSetAsync("set3", Encode("def"), when: When.NotExists);
-
- var s0 = conn.StringGetAsync("set");
- var s2 = conn.StringGetAsync("set2");
- var s3 = conn.StringGetAsync("set3");
-
- Assert.IsFalse(conn.Wait(x0));
- Assert.IsFalse(conn.Wait(x1));
- Assert.IsTrue(conn.Wait(x2));
- Assert.IsTrue(conn.Wait(x3));
- Assert.AreEqual("abc", (string)conn.Wait(s0));
- Assert.AreEqual("def", (string)conn.Wait(s2));
- Assert.AreEqual("def", (string)conn.Wait(s3));
- }
- }
-
- [Test]
- public void Ranges()
- {
- using (var muxer = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- if (!Config.GetFeatures(muxer).StringSetRange) Assert.Inconclusive();
- var conn = muxer.GetDatabase(2);
-
- conn.KeyDeleteAsync("range");
-
- conn.StringSetAsync("range", "abcdefghi");
- conn.StringSetRangeAsync("range", 2, "xy");
- conn.StringSetRangeAsync("range", 4, Encode("z"));
-
- var val = conn.StringGetAsync("range");
-
- Assert.AreEqual("abxyzfghi", (string)conn.Wait(val));
- }
- }
-
- [Test]
- public void IncrDecr()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(2);
- conn.KeyDeleteAsync("incr");
-
- conn.StringSetAsync("incr", "2");
- var v1 = conn.StringIncrementAsync("incr");
- var v2 = conn.StringIncrementAsync("incr", 5);
- var v3 = conn.StringIncrementAsync("incr", -2);
- var v4 = conn.StringDecrementAsync("incr");
- var v5 = conn.StringDecrementAsync("incr", 5);
- var v6 = conn.StringDecrementAsync("incr", -2);
- var s = conn.StringGetAsync("incr");
-
- Assert.AreEqual(3, conn.Wait(v1));
- Assert.AreEqual(8, conn.Wait(v2));
- Assert.AreEqual(6, conn.Wait(v3));
- Assert.AreEqual(5, conn.Wait(v4));
- Assert.AreEqual(0, conn.Wait(v5));
- Assert.AreEqual(2, conn.Wait(v6));
- Assert.AreEqual("2", (string)conn.Wait(s));
- }
- }
- [Test]
- public void IncrDecrFloat()
- {
- using (var muxer = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- if (!Config.GetFeatures(muxer).IncrementFloat) Assert.Inconclusive();
- var conn = muxer.GetDatabase(2);
- conn.KeyDelete("incr");
-
- conn.StringSetAsync("incr", "2");
- var v1 = conn.StringIncrementAsync("incr", 1.1);
- var v2 = conn.StringIncrementAsync("incr", 5.0);
- var v3 = conn.StringIncrementAsync("incr", -2.0);
- var v4 = conn.StringIncrementAsync("incr", -1.0);
- var v5 = conn.StringIncrementAsync("incr", -5.0);
- var v6 = conn.StringIncrementAsync("incr", 2.0);
-
- var s = conn.StringGetAsync("incr");
-
- Config.AssertNearlyEqual(3.1, conn.Wait(v1));
- Config.AssertNearlyEqual(8.1, conn.Wait(v2));
- Config.AssertNearlyEqual(6.1, conn.Wait(v3));
- Config.AssertNearlyEqual(5.1, conn.Wait(v4));
- Config.AssertNearlyEqual(0.1, conn.Wait(v5));
- Config.AssertNearlyEqual(2.1, conn.Wait(v6));
- Assert.AreEqual("2.1", (string)conn.Wait(s));
- }
- }
-
- [Test]
- public void GetRange()
- {
- using (var muxer = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- var conn = muxer.GetDatabase(2);
- conn.KeyDeleteAsync("range");
-
- conn.StringSetAsync("range", "abcdefghi");
- var s = conn.StringGetRangeAsync("range", 2, 4);
- var b = conn.StringGetRangeAsync("range", 2, 4);
-
- Assert.AreEqual("cde", (string)conn.Wait(s));
- Assert.AreEqual("cde", Decode(conn.Wait(b)));
- }
- }
-
- [Test]
- public void BitCount()
- {
- using (var muxer = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- if (!Config.GetFeatures(muxer).BitwiseOperations) Assert.Inconclusive();
-
- var conn = muxer.GetDatabase(0);
- conn.StringSetAsync("mykey", "foobar");
- var r1 = conn.StringBitCountAsync("mykey");
- var r2 = conn.StringBitCountAsync("mykey", 0, 0);
- var r3 = conn.StringBitCountAsync("mykey", 1, 1);
-
- Assert.AreEqual(26, conn.Wait(r1));
- Assert.AreEqual(4, conn.Wait(r2));
- Assert.AreEqual(6, conn.Wait(r3));
- }
- }
-
- [Test]
- public void BitOp()
- {
- using (var muxer = Config.GetUnsecuredConnection(waitForOpen: true))
- {
- if (!Config.GetFeatures(muxer).BitwiseOperations) Assert.Inconclusive();
- var conn = muxer.GetDatabase(0);
- conn.StringSetAsync("key1", new byte[] { 3 });
- conn.StringSetAsync("key2", new byte[] { 6 });
- conn.StringSetAsync("key3", new byte[] { 12 });
-
- var len_and = conn.StringBitOperationAsync(Bitwise.And, "and", new RedisKey[] { "key1", "key2", "key3" });
- var len_or = conn.StringBitOperationAsync(Bitwise.Or, "or", new RedisKey[] { "key1", "key2", "key3" });
- var len_xor = conn.StringBitOperationAsync(Bitwise.Xor, "xor", new RedisKey[] { "key1", "key2", "key3" });
- var len_not = conn.StringBitOperationAsync(Bitwise.Not, "not", "key1");
-
- Assert.AreEqual(1, conn.Wait(len_and));
- Assert.AreEqual(1, conn.Wait(len_or));
- Assert.AreEqual(1, conn.Wait(len_xor));
- Assert.AreEqual(1, conn.Wait(len_not));
-
- var r_and = ((byte[])conn.Wait(conn.StringGetAsync("and"))).Single();
- var r_or = ((byte[])conn.Wait(conn.StringGetAsync("or"))).Single();
- var r_xor = ((byte[])conn.Wait(conn.StringGetAsync("xor"))).Single();
- var r_not = ((byte[])conn.Wait(conn.StringGetAsync("not"))).Single();
-
- Assert.AreEqual((byte)(3 & 6 & 12), r_and);
- Assert.AreEqual((byte)(3 | 6 | 12), r_or);
- Assert.AreEqual((byte)(3 ^ 6 ^ 12), r_xor);
- Assert.AreEqual(unchecked((byte)(~3)), r_not);
-
- }
-
- }
-
- [Test]
- public void RangeString()
- {
- using (var muxer = Config.GetUnsecuredConnection())
- {
- var conn = muxer.GetDatabase(0);
- conn.StringSetAsync("my key", "hello world");
- var result = conn.StringGetRangeAsync("my key", 2, 6);
- Assert.AreEqual("llo w", (string)conn.Wait(result));
- }
- }
- static byte[] Encode(string value) { return Encoding.UTF8.GetBytes(value); }
- static string Decode(byte[] value) { return Encoding.UTF8.GetString(value); }
- }
-}
diff --git a/MigratedBookSleeveTestSuite/Transactions.cs b/MigratedBookSleeveTestSuite/Transactions.cs
deleted file mode 100644
index 9192201a7..000000000
--- a/MigratedBookSleeveTestSuite/Transactions.cs
+++ /dev/null
@@ -1,296 +0,0 @@
-//using System.Threading.Tasks;
-//using NUnit.Framework;
-//using System.Collections.Generic;
-//using System;
-//using System.Linq;
-//using BookSleeve;
-//using System.Text;
-//using System.Threading;
-
-//namespace Tests
-//{
-// [TestFixture]
-// public class Transactions // http://redis.io/commands#transactions
-// {
-
-
-// [Test]
-// public void TestBasicMultiExec()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(1, "tran");
-// conn.Keys.Remove(2, "tran");
-
-// using (var tran = conn.CreateTransaction())
-// {
-// var s1 = tran.Strings.Set(1, "tran", "abc");
-// var s2 = tran.Strings.Set(2, "tran", "def");
-// var g1 = tran.Strings.GetString(1, "tran");
-// var g2 = tran.Strings.GetString(2, "tran");
-
-// var outsideTran = conn.Strings.GetString(1, "tran");
-
-// var exec = tran.Execute();
-
-// Assert.IsNull(conn.Wait(outsideTran));
-// Assert.AreEqual("abc", conn.Wait(g1));
-// Assert.AreEqual("def", conn.Wait(g2));
-// conn.Wait(s1);
-// conn.Wait(s2);
-// conn.Wait(exec);
-// }
-
-// }
-// }
-
-// [Test]
-// public void TestRollback()
-// {
-// using (var conn = Config.GetUnsecuredConnection())
-// using (var tran = conn.CreateTransaction())
-// {
-// var task = tran.Strings.Set(4, "abc", "def");
-// tran.Discard();
-
-// Assert.IsTrue(task.IsCanceled, "should be cancelled");
-// try
-// {
-// conn.Wait(task);
-// }
-// catch (TaskCanceledException)
-// { }// ok, else boom!
-
-// }
-// }
-
-// [Test]
-// public void TestDispose()
-// {
-// Task task;
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// using (var tran = conn.CreateTransaction())
-// {
-// task = tran.Strings.Set(4, "abc", "def");
-// }
-// Assert.IsTrue(task.IsCanceled, "should be cancelled");
-// try
-// {
-// conn.Wait(task);
-// }
-// catch (TaskCanceledException)
-// { }// ok, else boom!
-// }
-// }
-
-// [Test]
-// public void BlogDemo()
-// {
-// int db = 8;
-// using (var conn = Config.GetUnsecuredConnection())
-// {
-// conn.Keys.Remove(db, "foo"); // just to reset
-// using (var tran = conn.CreateTransaction())
-// { // deliberately ignoring INCRBY here
-// tran.AddCondition(Condition.KeyNotExists(db, "foo"));
-// var t1 = tran.Strings.Increment(db, "foo");
-// var t2 = tran.Strings.Increment(db, "foo");
-// var val = tran.Strings.GetString(db, "foo");
-
-// var t3 = tran.Execute(); // this *still* returns a Task
-
-// Assert.AreEqual(true, conn.Wait(t3));
-// Assert.AreEqual(1, conn.Wait(t1));
-// Assert.AreEqual(2, conn.Wait(t2));
-// Assert.AreEqual("2", conn.Wait(val));
-// }
-// }
-// }
-
-// [Test]
-// public void AbortWorks()
-// {
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// {
-// conn.CompletionMode = ResultCompletionMode.PreserveOrder;
-// conn.Keys.Remove(0, "AbortWorks");
-// using (var tran = conn.CreateTransaction())
-// {
-// var condition = tran.AddCondition(Condition.KeyExists(0, "AbortWorks"));
-// var rename = tran.Strings.Increment(0, "key");
-// var success = conn.Wait(tran.Execute());
-
-// Assert.IsFalse(success, "success");
-// Assert.IsFalse(conn.Wait(condition), "condition");
-// Assert.AreEqual(TaskStatus.Canceled, rename.Status, "rename");
-// }
-// }
-// }
-// [Test]
-// public void SignalRSend()
-// {
-// const int db = 3;
-// const string idKey = "newid";
-// const string channel = "SignalRSend";
-// using (var conn = Config.GetUnsecuredConnection(waitForOpen: true))
-// using (var sub = conn.GetOpenSubscriberChannel())
-// {
-// conn.CompletionMode = ResultCompletionMode.ConcurrentIfContinuation;
-// sub.CompletionMode = ResultCompletionMode.PreserveOrder;
-// var received = new List();
-// sub.Subscribe(channel, (chan, payload) =>
-// {
-// lock (received) { received.Add(Encoding.UTF8.GetString(payload)); }
-// });
-// conn.Keys.Remove(db, idKey);
-
-// int totalAttempts = 0;
-// var evt = new ManualResetEvent(false);
-// const int threadCount = 2;
-// const int perThread = 5;
-// int unreadyThreads = threadCount;
-// ParameterizedThreadStart work = state =>
-// {
-// string thread = (string)state;
-// if (Interlocked.Decrement(ref unreadyThreads) == 0)
-// {
-// // all threads ready; unleash the hounds!
-// evt.Set();
-// }
-// else
-// {
-// evt.WaitOne();
-// }
-
-// for (int i = 0; i < perThread; i++)
-// {
-// int attempts = Send(conn, idKey, db, channel, thread + ":" + i).Result;
-// Interlocked.Add(ref totalAttempts, attempts);
-// }
-
-// };
-// var threads = new Thread[unreadyThreads];
-// for (int i = 0; i < threads.Length; i++) threads[i] = new Thread(work);
-// for (int i = 0; i < threads.Length; i++) threads[i].Start(i.ToString());
-// for (int i = 0; i < threads.Length; i++) threads[i].Join();
-
-// const int expected = perThread * threadCount;
-// // it doesn't matter that this number is big; we are testing the pathological worst-case
-// // scenario here; multiple threads aggressively causing conflicts
-// Console.WriteLine("total messages: {0} (vs {1} theoretical)", totalAttempts, expected);
-
-// // check we got everything we expected, and nothing more; the messages should
-// // all be increasing; we should have every thread/loop combination
-// Assert.AreEqual(expected, received.Count, "total messages");
-// for (int i = 0; i < expected; i++)
-// {
-// string want = (i + 1) + ":";
-// Assert.IsTrue(received[i].StartsWith(want), want);
-// }
-// for (int i = 0; i < threadCount; i++)
-// {
-// for (int j = 0; j < perThread; j++)
-// {
-// string want = ":" + i + ":" + j;
-// bool found = received.Any(x => x.EndsWith(want));
-// Assert.IsTrue(found, want);
-// }
-// }
-// }
-// }
-// static async Task Send(RedisConnection conn, string idKey, int db, string channel, string data)
-// {
-// int attempts = 0;
-// bool success;
-// do
-// {
-// var oldId = await conn.Strings.GetInt64(db, idKey).SafeAwaitable().ConfigureAwait(false); // important: let this be nullable;
-// // means "doesn't exist"
-// var newId = (oldId ?? 0) + 1;
-// var payload = Pack(newId, data);
-
-// using (var tran = conn.CreateTransaction())
-// {
-// var x0 = tran.AddCondition(Condition.KeyEquals(db, idKey, oldId)).SafeAwaitable();
-// var x1 = tran.Strings.Increment(db, idKey).SafeAwaitable();
-// var x2 = tran.Publish(channel, payload).SafeAwaitable();
-// success = await tran.Execute().SafeAwaitable().ConfigureAwait(false);
-
-// if (success)
-// {
-// // still expect all of these to get answers
-// await Task.WhenAll(x0, x1, x2);
-
-// Assert.IsTrue(x0.Result, "condition passed");
-// Assert.AreEqual(newId, x1.Result);
-// }
-// else
-// {
-// // can't say much about x0; could have got past that
-// Assert.IsTrue(await IsCancelled(x1));
-// Assert.IsTrue(await IsCancelled(x2));
-// }
-
-// attempts++;
-// }
-// } while (!success);
-// return attempts;
-// }
-
-// [Test]
-// public void Issue43()
-// {
-// using(var conn = Config.GetRemoteConnection())
-// {
-// conn.Keys.Remove(0, "anExistingKey1");
-// conn.Keys.Remove(0, "anExistingKey2");
-// conn.Keys.Remove(0, "anExistingKey3");
-// conn.Strings.Set(0, "anExistingKey1", "anExistingKey1");
-// conn.Strings.Set(0, "anExistingKey2", "anExistingKey2");
-// conn.Strings.Set(0, "anExistingKey3", "anExistingKey3");
-// for(int i = 0; i < 10000; i++)
-// {
-// using(var tx = conn.CreateTransaction())
-// {
-// var cond1 = tx.AddCondition(Condition.KeyExists(0, "anExistingKey1"));
-// var cond2 = tx.AddCondition(Condition.KeyExists(0, "anExistingKey2"));
-// var cond3 = tx.AddCondition(Condition.KeyExists(0, "anExistingKey3"));
-
-// tx.Strings.Increment(0, "foo", 1);
-// tx.Strings.Increment(0, "foo", 1);
-// tx.Strings.Increment(0, "foo", 1);
-
-// var txRes = tx.Execute();
-
-// Assert.IsTrue(tx.Wait(cond1), "cond1" + i); //--> ok
-// Assert.IsTrue(tx.Wait(cond2), "cond2" + i); //--> ok
-// Assert.IsTrue(tx.Wait(cond3), "cond3" + i); //--> ok
-// Assert.IsTrue(tx.Wait(txRes), "txRes" + i); //--> not ok: false
-// }
-// }
-// }
-// }
-
-// static async Task IsCancelled(Task task)
-// {
-// try
-// {
-// await task;
-// return false;
-// }
-// catch
-// {
-// return task.IsCanceled;
-// }
-// }
-
-// static byte[] Pack(long id, string data)
-// {
-// return Encoding.UTF8.GetBytes(id + ":" + data);
-// }
-
-
-// }
-//}
-
diff --git a/MigratedBookSleeveTestSuite/redis-sharp.cs b/MigratedBookSleeveTestSuite/redis-sharp.cs
deleted file mode 100644
index d9d9b3016..000000000
--- a/MigratedBookSleeveTestSuite/redis-sharp.cs
+++ /dev/null
@@ -1,877 +0,0 @@
-// preamble: original source: https://github.com/migueldeicaza/redis-sharp/blob/master/redis-sharp.cs
-// included here for performance test purposes only; this is a separate and parallel implementation
-
-
-//
-// redis-sharp.cs: ECMA CLI Binding to the Redis key-value storage system
-//
-// Authors:
-// Miguel de Icaza (miguel@gnome.org)
-//
-// Copyright 2010 Novell, Inc.
-//
-// Licensed under the same terms of reddis: new BSD license.
-//
-
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net.Sockets;
-using System.Text;
-
-public class Redis : IDisposable
-{
- Socket socket;
- BufferedStream bstream;
-
- public enum KeyType
- {
- None, String, List, Set
- }
-
- public class ResponseException : Exception
- {
- public ResponseException(string code)
- : base("Response error")
- {
- Code = code;
- }
-
- public string Code { get; private set; }
- }
-
- public Redis(string host, int port)
- {
- if (host == null)
- throw new ArgumentNullException(nameof(host));
-
- Host = host;
- Port = port;
- SendTimeout = -1;
- }
-
- public Redis(string host)
- : this(host, 6379)
- {
- }
-
- public Redis()
- : this("localhost", 6379)
- {
- }
-
- public string Host { get; private set; }
- public int Port { get; private set; }
- public int RetryTimeout { get; set; }
- public int RetryCount { get; set; }
- public int SendTimeout { get; set; }
- public string Password { get; set; }
-
- int db;
- public int Db
- {
- get
- {
- return db;
- }
-
- set
- {
- db = value;
- SendExpectSuccess("SELECT {0}\r\n", db);
- }
- }
-
- public string this[string key]
- {
- get { return GetString(key); }
- set { Set(key, value); }
- }
-
- public void Set(string key, string value)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- if (value == null)
- throw new ArgumentNullException(nameof(value));
-
- Set(key, Encoding.UTF8.GetBytes(value));
- }
-
- public void Set(string key, byte[] value)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- if (value == null)
- throw new ArgumentNullException(nameof(value));
-
- if (value.Length > 1073741824)
- throw new ArgumentException("value exceeds 1G", nameof(value));
-
- if (!SendDataCommand(value, "SET {0} {1}\r\n", key, value.Length))
- throw new Exception("Unable to connect");
- ExpectSuccess();
- }
-
- public bool SetNX(string key, string value)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- if (value == null)
- throw new ArgumentNullException(nameof(value));
-
- return SetNX(key, Encoding.UTF8.GetBytes(value));
- }
-
- public bool SetNX(string key, byte[] value)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- if (value == null)
- throw new ArgumentNullException(nameof(value));
-
- if (value.Length > 1073741824)
- throw new ArgumentException("value exceeds 1G", nameof(value));
-
- return SendDataExpectInt(value, "SETNX {0} {1}\r\n", key, value.Length) > 0 ? true : false;
- }
-
- public void Set(IDictionary dict)
- {
- Set(dict.ToDictionary(k => k.Key, v => Encoding.UTF8.GetBytes(v.Value)));
- }
-
- public void Set(IDictionary dict)
- {
- if (dict == null)
- throw new ArgumentNullException(nameof(dict));
-
- var nl = Encoding.UTF8.GetBytes("\r\n");
-
- var ms = new MemoryStream();
- foreach (var key in dict.Keys)
- {
- var val = dict[key];
-
- var kLength = Encoding.UTF8.GetBytes("$" + key.Length + "\r\n");
- var k = Encoding.UTF8.GetBytes(key + "\r\n");
- var vLength = Encoding.UTF8.GetBytes("$" + val.Length + "\r\n");
- ms.Write(kLength, 0, kLength.Length);
- ms.Write(k, 0, k.Length);
- ms.Write(vLength, 0, vLength.Length);
- ms.Write(val, 0, val.Length);
- ms.Write(nl, 0, nl.Length);
- }
-
- SendDataCommand(ms.ToArray(), "*" + (dict.Count * 2 + 1) + "\r\n$4\r\nMSET\r\n");
- ExpectSuccess();
- }
-
- public byte[] Get(string key)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectData(null, "GET " + key + "\r\n");
- }
-
- public string GetString(string key)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return Encoding.UTF8.GetString(Get(key));
- }
-
- public byte[][] Sort(SortOptions options)
- {
- return SendDataCommandExpectMultiBulkReply(null, options.ToCommand() + "\r\n");
- }
-
- public byte[] GetSet(string key, byte[] value)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- if (value == null)
- throw new ArgumentNullException(nameof(value));
-
- if (value.Length > 1073741824)
- throw new ArgumentException("value exceeds 1G", nameof(value));
-
- if (!SendDataCommand(value, "GETSET {0} {1}\r\n", key, value.Length))
- throw new Exception("Unable to connect");
-
- return ReadData();
- }
-
- public string GetSet(string key, string value)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- if (value == null)
- throw new ArgumentNullException(nameof(value));
- return Encoding.UTF8.GetString(GetSet(key, Encoding.UTF8.GetBytes(value)));
- }
-
- string ReadLine()
- {
- var sb = new StringBuilder();
- int c;
-
- while ((c = bstream.ReadByte()) != -1)
- {
- if (c == '\r')
- continue;
- if (c == '\n')
- break;
- sb.Append((char)c);
- }
- return sb.ToString();
- }
-
- void Connect()
- {
- socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- socket.NoDelay = true;
- socket.SendTimeout = SendTimeout;
- socket.Connect(Host, Port);
- if (!socket.Connected)
- {
- socket.Dispose();
- socket = null;
- return;
- }
- bstream = new BufferedStream(new NetworkStream(socket), 16 * 1024);
-
- if (Password != null)
- SendExpectSuccess("AUTH {0}\r\n", Password);
- }
-
- byte[] end_data = new byte[] { (byte)'\r', (byte)'\n' };
-
- bool SendDataCommand(byte[] data, string cmd, params object[] args)
- {
- if (socket == null)
- Connect();
- if (socket == null)
- return false;
-
- var s = args.Length > 0 ? String.Format(cmd, args) : cmd;
- byte[] r = Encoding.UTF8.GetBytes(s);
- try
- {
- Log("S: " + String.Format(cmd, args));
- socket.Send(r);
- if (data != null)
- {
- socket.Send(data);
- socket.Send(end_data);
- }
- }
- catch (SocketException)
- {
- // timeout;
- socket.Dispose();
- socket = null;
-
- return false;
- }
- return true;
- }
-
- bool SendCommand(string cmd, params object[] args)
- {
- if (socket == null)
- Connect();
- if (socket == null)
- return false;
-
- var s = args != null && args.Length > 0 ? String.Format(cmd, args) : cmd;
- byte[] r = Encoding.UTF8.GetBytes(s);
- try
- {
- Log("S: " + String.Format(cmd, args));
- socket.Send(r);
- }
- catch (SocketException)
- {
- // timeout;
- socket.Dispose();
- socket = null;
-
- return false;
- }
- return true;
- }
-
- [Conditional("DEBUG")]
- void Log(string fmt, params object[] args)
- {
- Console.WriteLine("{0}", String.Format(fmt, args).Trim());
- }
-
- void ExpectSuccess()
- {
- int c = bstream.ReadByte();
- if (c == -1)
- throw new ResponseException("No more data");
-
- var s = ReadLine();
- Log((char)c + s);
- if (c == '-')
- throw new ResponseException(s.StartsWith("ERR") ? s.Substring(4) : s);
- }
-
- void SendExpectSuccess(string cmd, params object[] args)
- {
- if (!SendCommand(cmd, args))
- throw new Exception("Unable to connect");
-
- ExpectSuccess();
- }
-
- int SendDataExpectInt(byte[] data, string cmd, params object[] args)
- {
- if (!SendDataCommand(data, cmd, args))
- throw new Exception("Unable to connect");
-
- int c = bstream.ReadByte();
- if (c == -1)
- throw new ResponseException("No more data");
-
- var s = ReadLine();
- Log("R: " + s);
- if (c == '-')
- throw new ResponseException(s.StartsWith("ERR") ? s.Substring(4) : s);
- if (c == ':')
- {
- int i;
- if (int.TryParse(s, out i))
- return i;
- }
- throw new ResponseException("Unknown reply on integer request: " + c + s);
- }
-
- int SendExpectInt(string cmd, params object[] args)
- {
- if (!SendCommand(cmd, args))
- throw new Exception("Unable to connect");
-
- int c = bstream.ReadByte();
- if (c == -1)
- throw new ResponseException("No more data");
-
- var s = ReadLine();
- Log("R: " + s);
- if (c == '-')
- throw new ResponseException(s.StartsWith("ERR") ? s.Substring(4) : s);
- if (c == ':')
- {
- int i;
- if (int.TryParse(s, out i))
- return i;
- }
- throw new ResponseException("Unknown reply on integer request: " + c + s);
- }
-
- string SendExpectString(string cmd, params object[] args)
- {
- if (!SendCommand(cmd, args))
- throw new Exception("Unable to connect");
-
- int c = bstream.ReadByte();
- if (c == -1)
- throw new ResponseException("No more data");
-
- var s = ReadLine();
- Log("R: " + s);
- if (c == '-')
- throw new ResponseException(s.StartsWith("ERR") ? s.Substring(4) : s);
- if (c == '+')
- return s;
-
- throw new ResponseException("Unknown reply on integer request: " + c + s);
- }
-
- //
- // This one does not throw errors
- //
- string SendGetString(string cmd, params object[] args)
- {
- if (!SendCommand(cmd, args))
- throw new Exception("Unable to connect");
-
- return ReadLine();
- }
-
- byte[] SendExpectData(byte[] data, string cmd, params object[] args)
- {
- if (!SendDataCommand(data, cmd, args))
- throw new Exception("Unable to connect");
-
- return ReadData();
- }
-
- byte[] ReadData()
- {
- string r = ReadLine();
- Log("R: {0}", r);
- if (r.Length == 0)
- throw new ResponseException("Zero length respose");
-
- char c = r[0];
- if (c == '-')
- throw new ResponseException(r.StartsWith("-ERR") ? r.Substring(5) : r.Substring(1));
-
- if (c == '$')
- {
- if (r == "$-1")
- return null;
- int n;
-
- if (Int32.TryParse(r.Substring(1), out n))
- {
- byte[] retbuf = new byte[n];
-
- int bytesRead = 0;
- do
- {
- int read = bstream.Read(retbuf, bytesRead, n - bytesRead);
- if (read < 1)
- throw new ResponseException("Invalid termination mid stream");
- bytesRead += read;
- }
- while (bytesRead < n);
- if (bstream.ReadByte() != '\r' || bstream.ReadByte() != '\n')
- throw new ResponseException("Invalid termination");
- return retbuf;
- }
- throw new ResponseException("Invalid length");
- }
-
- //returns the number of matches
- if (c == '*')
- {
- int n;
- if (Int32.TryParse(r.Substring(1), out n))
- return n <= 0 ? new byte[0] : ReadData();
-
- throw new ResponseException("Unexpected length parameter" + r);
- }
-
- throw new ResponseException("Unexpected reply: " + r);
- }
-
- public bool ContainsKey(string key)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectInt("EXISTS " + key + "\r\n") == 1;
- }
-
- public bool Remove(string key)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectInt("DEL " + key + "\r\n", key) == 1;
- }
-
- public int Remove(params string[] args)
- {
- if (args == null)
- throw new ArgumentNullException(nameof(args));
- return SendExpectInt("DEL " + string.Join(" ", args) + "\r\n");
- }
-
- public int Increment(string key)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectInt("INCR " + key + "\r\n");
- }
-
- public int Increment(string key, int count)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectInt("INCRBY {0} {1}\r\n", key, count);
- }
-
- public int Decrement(string key)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectInt("DECR " + key + "\r\n");
- }
-
- public int Decrement(string key, int count)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectInt("DECRBY {0} {1}\r\n", key, count);
- }
-
- public KeyType TypeOf(string key)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- switch (SendExpectString("TYPE {0}\r\n", key))
- {
- case "none":
- return KeyType.None;
- case "string":
- return KeyType.String;
- case "set":
- return KeyType.Set;
- case "list":
- return KeyType.List;
- }
- throw new ResponseException("Invalid value");
- }
-
- public string RandomKey()
- {
- return SendExpectString("RANDOMKEY\r\n");
- }
-
- public bool Rename(string oldKeyname, string newKeyname)
- {
- if (oldKeyname == null)
- throw new ArgumentNullException(nameof(oldKeyname));
- if (newKeyname == null)
- throw new ArgumentNullException(nameof(newKeyname));
- return SendGetString("RENAME {0} {1}\r\n", oldKeyname, newKeyname)[0] == '+';
- }
-
- public bool Expire(string key, int seconds)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectInt("EXPIRE {0} {1}\r\n", key, seconds) == 1;
- }
-
- public bool ExpireAt(string key, int time)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectInt("EXPIREAT {0} {1}\r\n", key, time) == 1;
- }
-
- public int TimeToLive(string key)
- {
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- return SendExpectInt("TTL {0}\r\n", key);
- }
-
- public int DbSize
- {
- get
- {
- return SendExpectInt("DBSIZE\r\n");
- }
- }
-
- public string Save()
- {
- return SendGetString("SAVE\r\n");
- }
-
- public void BackgroundSave()
- {
- SendGetString("BGSAVE\r\n");
- }
-
- public void Shutdown()
- {
- SendGetString("SHUTDOWN\r\n");
- }
-
- public void FlushAll()
- {
- SendGetString("FLUSHALL\r\n");
- }
-
- public void FlushDb()
- {
- SendGetString("FLUSHDB\r\n");
- }
-
- const long UnixEpoch = 621355968000000000L;
-
- public DateTime LastSave
- {
- get
- {
- int t = SendExpectInt("LASTSAVE\r\n");
-
- return new DateTime(UnixEpoch) + TimeSpan.FromSeconds(t);
- }
- }
-
- public Dictionary GetInfo()
- {
- byte[] r = SendExpectData(null, "INFO\r\n");
- var dict = new Dictionary();
-
- foreach (var line in Encoding.UTF8.GetString(r).Split('\n'))
- {
- int p = line.IndexOf(':');
- if (p == -1)
- continue;
- dict.Add(line.Substring(0, p), line.Substring(p + 1));
- }
- return dict;
- }
-
- public string[] Keys
- {
- get
- {
- string commandResponse = Encoding.UTF8.GetString(SendExpectData(null, "KEYS *\r\n"));
- if (commandResponse.Length < 1)
- return new string[0];
- else
- return commandResponse.Split(' ');
- }
- }
-
- public string[] GetKeys(string pattern)
- {
- if (pattern == null)
- throw new ArgumentNullException("key");
- var keys = SendExpectData(null, "KEYS {0}\r\n", pattern);
- if (keys.Length == 0)
- return new string[0];
- return Encoding.UTF8.GetString(keys).Split(' ');
- }
-
- public byte[][] GetKeys(params string[] keys)
- {
- if (keys == null)
- throw new ArgumentNullException("key1");
- if (keys.Length == 0)
- throw new ArgumentException("keys");
-
- return SendDataCommandExpectMultiBulkReply(null, "MGET {0}\r\n", string.Join(" ", keys));
- }
-
-
- public byte[][] SendDataCommandExpectMultiBulkReply(byte[] data, string command, params object[] args)
- {
- if (!SendDataCommand(data, command, args))
- throw new Exception("Unable to connect");
- int c = bstream.ReadByte();
- if (c == -1)
- throw new ResponseException("No more data");
-
- var s = ReadLine();
- Log("R: " + s);
- if (c == '-')
- throw new ResponseException(s.StartsWith("ERR") ? s.Substring(4) : s);
- if (c == '*')
- {
- int count;
- if (int.TryParse(s, out count))
- {
- var result = new byte[count][];
-
- for (int i = 0; i < count; i++)
- result[i] = ReadData();
-
- return result;
- }
- }
- throw new ResponseException("Unknown reply on multi-request: " + c + s);
- }
-
- #region List commands
- public byte[][] ListRange(string key, int start, int end)
- {
- return SendDataCommandExpectMultiBulkReply(null, "LRANGE {0} {1} {2}\r\n", key, start, end);
- }
-
- public void RightPush(string key, string value)
- {
- SendExpectSuccess("RPUSH {0} {1}\r\n{2}\r\n", key, value.Length, value);
- }
-
- public int ListLength(string key)
- {
- return SendExpectInt("LLEN {0}\r\n", key);
- }
-
- public byte[] ListIndex(string key, int index)
- {
- SendCommand("LINDEX {0} {1}\r\n", key, index);
- return ReadData();
- }
-
- public byte[] LeftPop(string key)
- {
- SendCommand("LPOP {0}\r\n", key);
- return ReadData();
- }
- #endregion
-
- #region Set commands
- public bool AddToSet(string key, byte[] member)
- {
- return SendDataExpectInt(member, "SADD {0} {1}\r\n", key, member.Length) > 0;
- }
-
- public bool AddToSet(string key, string member)
- {
- return AddToSet(key, Encoding.UTF8.GetBytes(member));
- }
-
- public int CardinalityOfSet(string key)
- {
- return SendDataExpectInt(null, "SCARD {0}\r\n", key);
- }
-
- public bool IsMemberOfSet(string key, byte[] member)
- {
- return SendDataExpectInt(member, "SISMEMBER {0} {1}\r\n", key, member.Length) > 0;
- }
-
- public bool IsMemberOfSet(string key, string member)
- {
- return IsMemberOfSet(key, Encoding.UTF8.GetBytes(member));
- }
-
- public byte[][] GetMembersOfSet(string key)
- {
- return SendDataCommandExpectMultiBulkReply(null, "SMEMBERS {0}\r\n", key);
- }
-
- public byte[] GetRandomMemberOfSet(string key)
- {
- return SendExpectData(null, "SRANDMEMBER {0}\r\n", key);
- }
-
- public byte[] PopRandomMemberOfSet(string key)
- {
- return SendExpectData(null, "SPOP {0}\r\n", key);
- }
-
- public bool RemoveFromSet(string key, byte[] member)
- {
- return SendDataExpectInt(member, "SREM {0} {1}\r\n", key, member.Length) > 0;
- }
-
- public bool RemoveFromSet(string key, string member)
- {
- return RemoveFromSet(key, Encoding.UTF8.GetBytes(member));
- }
-
- public byte[][] GetUnionOfSets(params string[] keys)
- {
- if (keys == null)
- throw new ArgumentNullException();
-
- return SendDataCommandExpectMultiBulkReply(null, "SUNION " + string.Join(" ", keys) + "\r\n");
-
- }
-
- void StoreSetCommands(string cmd, string destKey, params string[] keys)
- {
- if (String.IsNullOrEmpty(cmd))
- throw new ArgumentNullException(nameof(cmd));
-
- if (String.IsNullOrEmpty(destKey))
- throw new ArgumentNullException(nameof(destKey));
-
- if (keys == null)
- throw new ArgumentNullException(nameof(keys));
-
- SendExpectSuccess("{0} {1} {2}\r\n", cmd, destKey, String.Join(" ", keys));
- }
-
- public void StoreUnionOfSets(string destKey, params string[] keys)
- {
- StoreSetCommands("SUNIONSTORE", destKey, keys);
- }
-
- public byte[][] GetIntersectionOfSets(params string[] keys)
- {
- if (keys == null)
- throw new ArgumentNullException();
-
- return SendDataCommandExpectMultiBulkReply(null, "SINTER " + string.Join(" ", keys) + "\r\n");
- }
-
- public void StoreIntersectionOfSets(string destKey, params string[] keys)
- {
- StoreSetCommands("SINTERSTORE", destKey, keys);
- }
-
- public byte[][] GetDifferenceOfSets(params string[] keys)
- {
- if (keys == null)
- throw new ArgumentNullException();
-
- return SendDataCommandExpectMultiBulkReply(null, "SDIFF " + string.Join(" ", keys) + "\r\n");
- }
-
- public void StoreDifferenceOfSets(string destKey, params string[] keys)
- {
- StoreSetCommands("SDIFFSTORE", destKey, keys);
- }
-
- public bool MoveMemberToSet(string srcKey, string destKey, byte[] member)
- {
- return SendDataExpectInt(member, "SMOVE {0} {1} {2}\r\n", srcKey, destKey, member.Length) > 0;
- }
- #endregion
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- ~Redis()
- {
- Dispose(false);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- SendCommand("QUIT\r\n");
- socket.Dispose();
- socket = null;
- }
- }
-}
-
-public class SortOptions
-{
- public string Key { get; set; }
- public bool Descending { get; set; }
- public bool Lexographically { get; set; }
- public Int32 LowerLimit { get; set; }
- public Int32 UpperLimit { get; set; }
- public string By { get; set; }
- public string StoreInKey { get; set; }
- public string Get { get; set; }
-
- public string ToCommand()
- {
- var command = "SORT " + this.Key;
- if (LowerLimit != 0 || UpperLimit != 0)
- command += " LIMIT " + LowerLimit + " " + UpperLimit;
- if (Lexographically)
- command += " ALPHA";
- if (!string.IsNullOrEmpty(By))
- command += " BY " + By;
- if (!string.IsNullOrEmpty(Get))
- command += " GET " + Get;
- if (!string.IsNullOrEmpty(StoreInKey))
- command += " STORE " + StoreInKey;
- return command;
- }
-}
diff --git a/NRediSearch.Test/ExampleUsage.cs b/NRediSearch.Test/ExampleUsage.cs
deleted file mode 100644
index 3d5428899..000000000
--- a/NRediSearch.Test/ExampleUsage.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System;
-using Xunit;
-using StackExchange.Redis;
-using NRediSearch;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace NRediSearch.Test
-{
- public class ExampleUsage : IDisposable
- {
- ConnectionMultiplexer conn;
- IDatabase db;
- public ExampleUsage()
- {
- conn = ConnectionMultiplexer.Connect("127.0.0.1:6379");
- db = conn.GetDatabase();
- }
- public void Dispose()
- {
- conn?.Dispose();
- conn = null;
- db = null;
- }
- [Fact]
- public void BasicUsage()
- {
- var client = new Client("testung", db);
-
- try { client.DropIndex(); } catch { } // reset DB
-
- // Defining a schema for an index and creating it:
- var sc = new Schema()
- .AddTextField("title", 5.0)
- .AddTextField("body", 1.0)
- .AddNumericField("price");
-
- Assert.True(client.CreateIndex(sc, Client.IndexOptions.Default));
-
- // note: using java API equivalent here; it would be nice to
- // use meta-programming / reflection instead in .NET
-
- // Adding documents to the index:
- var fields = new Dictionary();
- fields.Add("title", "hello world");
- fields.Add("body", "lorem ipsum");
- fields.Add("price", 1337);
-
- Assert.True(client.AddDocument("doc1", fields));
-
- // Creating a complex query
- var q = new Query("hello world")
- .AddFilter(new Query.NumericFilter("price", 1300, 1350))
- .Limit(0, 5);
-
- // actual search
- var res = client.Search(q);
-
- Assert.Equal(1, res.TotalResults);
- var item = res.Documents.Single();
- Assert.Equal("doc1", item.Id);
-
- Assert.True(item.HasProperty("title"));
- Assert.True(item.HasProperty("body"));
- Assert.True(item.HasProperty("price"));
- Assert.False(item.HasProperty("blap"));
-
- Assert.Equal("hello world", (string)item["title"]);
- Assert.Equal("lorem ipsum", (string)item["body"]);
- Assert.Equal(1337, (int)item["price"]);
-
-
-
- }
- }
-}
diff --git a/NRediSearch.Test/NRediSearch.Test.csproj b/NRediSearch.Test/NRediSearch.Test.csproj
deleted file mode 100644
index c6ff73816..000000000
--- a/NRediSearch.Test/NRediSearch.Test.csproj
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- netcoreapp1.1
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/NRediSearch/Client.cs b/NRediSearch/Client.cs
deleted file mode 100644
index 2d6611464..000000000
--- a/NRediSearch/Client.cs
+++ /dev/null
@@ -1,420 +0,0 @@
-// .NET port of https://github.com/RedisLabs/JRediSearch/
-
-using StackExchange.Redis;
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace NRediSearch
-{
- public sealed class Client
- {
- [Flags]
- public enum IndexOptions
- {
- ///
- /// All options disabled
- ///
- None = 0,
- ///
- /// Set this to tell the index not to save term offset vectors. This reduces memory consumption but does not
- /// allow performing exact matches, and reduces overall relevance of multi-term queries
- ///
- UseTermOffsets = 1,
- ///
- /// If set (default), we keep flags per index record telling us what fields the term appeared on,
- /// and allowing us to filter results by field
- ///
- KeepFieldFlags = 2,
- ///
- /// If set, we keep an index of the top entries per term, allowing extremely fast single word queries
- /// regardless of index size, at the cost of more memory
- ///
- UseScoreIndexes = 4,
- ///
- /// The default indexing options - use term offsets and keep fields flags
- ///
- Default = UseTermOffsets | KeepFieldFlags
- }
- private static void SerializeRedisArgs(IndexOptions flags, List