Skip to content

Commit 7f39c5d

Browse files
author
Niko Bergemann
committed
make basic tests execute one itme with and one time without password
1 parent 7a935d2 commit 7f39c5d

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

SqliteCache.Tests/BasicTests.cs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Text;
34
using System.Threading.Tasks;
45
using Microsoft.Extensions.Caching.Distributed;
@@ -47,7 +48,7 @@ private SqliteCache CreateDefault(bool persistent = true, string password = null
4748
return cacheDb;
4849
}
4950

50-
[DataTestMethod]
51+
[TestMethod]
5152
[DataRow(null)]
5253
[DataRow("testPassword")]
5354
public async Task BasicSetGet(string password)
@@ -77,9 +78,11 @@ public async Task BasicSetGet(string password)
7778
}
7879

7980
[TestMethod]
80-
public void ExpiredIgnored()
81+
[DataRow(null)]
82+
[DataRow("testPassword")]
83+
public void ExpiredIgnored(string password)
8184
{
82-
using (var cache = CreateDefault())
85+
using (var cache = CreateDefault(true, password))
8386
{
8487
cache.Set("hi there", DefaultEncoding.GetBytes("hello"),
8588
new DistributedCacheEntryOptions()
@@ -90,9 +93,11 @@ public void ExpiredIgnored()
9093
}
9194

9295
[TestMethod]
93-
public void ExpiredRenewal()
96+
[DataRow(null)]
97+
[DataRow("testPassword")]
98+
public void ExpiredRenewal(string password)
9499
{
95-
using (var cache = CreateDefault())
100+
using (var cache = CreateDefault(true, password))
96101
{
97102
cache.Set("hi there", DefaultEncoding.GetBytes("hello"),
98103
new DistributedCacheEntryOptions()
@@ -106,12 +111,14 @@ public void ExpiredRenewal()
106111
}
107112

108113
[TestMethod]
109-
public void ExpirationStoredInUtc()
114+
[DataRow(null)]
115+
[DataRow("testPassword")]
116+
public void ExpirationStoredInUtc(string password)
110117
{
111118
var expiryUtc = DateTimeOffset.UtcNow.AddMinutes(-1);
112119
var expiryLocal = expiryUtc.ToOffset(TimeSpan.FromHours(5));
113120

114-
using (var cache = CreateDefault())
121+
using (var cache = CreateDefault(true, password))
115122
{
116123
cache.Set("key", DefaultEncoding.GetBytes("value"), new DistributedCacheEntryOptions
117124
{
@@ -123,19 +130,23 @@ public void ExpirationStoredInUtc()
123130
}
124131

125132
[TestMethod]
126-
public void DoubleDispose()
133+
[DataRow(null)]
134+
[DataRow("testPassword")]
135+
public void DoubleDispose(string password)
127136
{
128-
using (var cache = CreateDefault(true))
137+
using (var cache = CreateDefault(true, password))
129138
{
130139
cache.Dispose();
131140
}
132141
}
133142

134143
#if NETCOREAPP3_0_OR_GREATER
135144
[TestMethod]
136-
public async Task AsyncDispose()
145+
[DataRow(null)]
146+
[DataRow("testPassword")]
147+
public async Task AsyncDispose(string password)
137148
{
138-
await using (var cache = CreateDefault(true))
149+
await using (var cache = CreateDefault(true, password))
139150
{
140151
await cache.SetAsync("foo", DefaultEncoding.GetBytes("hello"));
141152
var bytes = await cache.GetAsync("foo");

0 commit comments

Comments
 (0)