Skip to content

Commit 26c9279

Browse files
committed
Add Tagging Test
1 parent 20c317c commit 26c9279

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

src/plugins/StackExchangeRedisTest/ExtensionDatabaseProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ public static class ExtensionDatabaseProvider
1717
AbortOnConnectFail = true,
1818
Hosts = [new() { Host = "localhost", Port = 6379 }],
1919
Database = 5,
20-
//Ssl = true,
2120
AllowAdmin = true,
2221
KeyPrefix = "ExtensionTest:",
23-
//MaxValueLength = 1024,
22+
//MaxValueLength = 24,
2423
IsDefault = true,
2524
Name = "ExtensionTest",
2625
};

src/plugins/StackExchangeRedisTest/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ private static async Task Main(string[] args)
4848

4949
ExtensionDatabaseProvider.Start();
5050

51-
await RedisExtensionsTest.MemoryPackSerializer_TestAsync();
52-
await RedisExtensionsTest.MemoryPackSerializer_Null_TestAsync();
51+
//await RedisExtensionsTest.MemoryPackSerializer_TestAsync();
52+
//await RedisExtensionsTest.MemoryPackSerializer_Null_TestAsync();
53+
//await RedisExtensionsTest.MaxLength_TestAsync();
54+
await RedisExtensionsTest.Tagging_TestAsync();
5355

5456
ExtensionDatabaseProvider.Dispose();
5557
}

src/plugins/StackExchangeRedisTest/RedisExtensionsTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ public static class RedisExtensionsTest
77

88
#region Constants & Statics
99

10+
public static async Task MaxLength_TestAsync()
11+
{
12+
var database = ExtensionDatabaseProvider.GetDatabase();
13+
_ = await database.AddAsync("test3", new MyClass2(1, "null", "abcdefg"));
14+
15+
// System.ArgumentException: 'value cannot be longer than the MaxValueLength (Parameter 'test2')'
16+
}
17+
1018
public static async Task MemoryPackSerializer_Null_TestAsync()
1119
{
1220
var database = ExtensionDatabaseProvider.GetDatabase();
@@ -23,6 +31,14 @@ public static async Task MemoryPackSerializer_TestAsync()
2331
var data = await database.GetAsync<MyClass2>("test2");
2432
}
2533

34+
public static async Task Tagging_TestAsync()
35+
{
36+
var database = ExtensionDatabaseProvider.GetDatabase();
37+
_ = await database.AddAsync("test4", new MyClass2(1, "null", "abcdefg"), tags: ["tag1"]);
38+
39+
await database.RemoveByTagAsync("tag1");
40+
}
41+
2642
#endregion
2743

2844
}

0 commit comments

Comments
 (0)