Skip to content

Commit 4aea38a

Browse files
committed
Added overloads with string values (#247)
1 parent 1579412 commit 4aea38a

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

src/MyTested.AspNetCore.Mvc.Caching/Builders/Contracts/Data/DistributedCache/IDistributedCacheBuilder.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ public interface IDistributedCacheBuilder
1717
/// <returns>The same <see cref="IAndDistributedCacheBuilder"/>.</returns>
1818
IAndDistributedCacheBuilder WithEntry(string key, byte[] value);
1919

20+
/// <summary>
21+
/// Adds cache entry to the mocked <see cref="IDistributedCache"/>.
22+
/// </summary>
23+
/// <param name="key">Key of the cache entry.</param>
24+
/// <param name="value">String value of the cache entry.</param>
25+
/// <returns>The same <see cref="IAndDistributedCacheBuilder"/>.</returns>
26+
IAndDistributedCacheBuilder WithEntry(string key, string value);
27+
2028
/// <summary>
2129
/// Adds cache entry to the mocked <see cref="IDistributedCache"/>.
2230
/// </summary>
@@ -26,6 +34,15 @@ public interface IDistributedCacheBuilder
2634
/// <returns>The same <see cref="IAndDistributedCacheBuilder"/>.</returns>
2735
IAndDistributedCacheBuilder WithEntry(string key, byte[] value, DistributedCacheEntryOptions options);
2836

37+
/// <summary>
38+
/// Adds cache entry to the mocked <see cref="IDistributedCache"/>.
39+
/// </summary>
40+
/// <param name="key">Key of the cache entry.</param>
41+
/// <param name="value">String value of the cache entry.</param>
42+
/// <param name="options"><see cref="DistributedCacheEntryOptions"/> of the cache entry.</param>
43+
/// <returns>The same <see cref="IAndDistributedCacheBuilder"/>.</returns>
44+
IAndDistributedCacheBuilder WithEntry(string key, string value, DistributedCacheEntryOptions options);
45+
2946
/// <summary>
3047
/// Adds cache entry to the mocked <see cref="IDistributedCache"/>.
3148
/// </summary>
@@ -40,5 +57,12 @@ public interface IDistributedCacheBuilder
4057
/// <returns>The same <see cref="IAndDistributedCacheBuilder"/>.</returns>
4158
IAndDistributedCacheBuilder WithEntries(IDictionary<string, byte[]> entries);
4259

60+
/// <summary>
61+
/// Adds cache entries to the mocked <see cref="IDistributedCache"/>.
62+
/// </summary>
63+
/// <param name="entries">Dictionary of cache entries.</param>
64+
/// <returns>The same <see cref="IAndDistributedCacheBuilder"/>.</returns>
65+
IAndDistributedCacheBuilder WithEntries(IDictionary<string, string> entries);
66+
4367
}
4468
}

src/MyTested.AspNetCore.Mvc.Caching/Builders/Contracts/Data/DistributedCache/IDistributedCacheEntryBuilder.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ public interface IDistributedCacheEntryBuilder
1515
/// <returns>The same <see cref="IAndDistributedCacheEntryBuilder"/>.</returns>
1616
IAndDistributedCacheEntryBuilder WithValue(byte[] value);
1717

18+
/// <summary>
19+
/// Sets the value of the built <see cref="IDistributedCache"/> entry.
20+
/// </summary>
21+
/// <param name="value">Cache entry string value to set.</param>
22+
/// <returns>The same <see cref="IAndDistributedCacheEntryBuilder"/>.</returns>
23+
IAndDistributedCacheEntryBuilder WithValue(string value);
24+
1825
/// <summary>
1926
/// Sets the <see cref="DistributedCacheEntryOptions.AbsoluteExpiration"/> value to the built <see cref="IDistributedCache"/> entry.
2027
/// </summary>

src/MyTested.AspNetCore.Mvc.Caching/Builders/Contracts/Data/DistributedCache/IDistributedCacheEntryTestBuilder.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ public interface IDistributedCacheEntryTestBuilder
1515
/// <returns>The same <see cref="IAndDistributedCacheEntryTestBuilder"/>.</returns>
1616
IAndDistributedCacheEntryTestBuilder WithValue(byte[] value);
1717

18+
/// <summary>
19+
/// Sets the value of the built <see cref="IDistributedCache"/> entry.
20+
/// </summary>
21+
/// <param name="value">Cache entry string value to set.</param>
22+
/// <returns>The same <see cref="IAndDistributedCacheEntryTestBuilder"/>.</returns>
23+
IAndDistributedCacheEntryTestBuilder WithValue(string value);
24+
1825
/// <summary>
1926
/// Sets the <see cref="DistributedCacheEntryOptions.AbsoluteExpiration"/> value to the built <see cref="IDistributedCache"/> entry.
2027
/// </summary>

src/MyTested.AspNetCore.Mvc.Caching/Builders/Contracts/Data/DistributedCache/IDistributedCacheTestBuilder.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ public interface IDistributedCacheTestBuilder
1717
/// <returns>The same <see cref="IAndDistributedCacheTestBuilder"/>.</returns>
1818
IAndDistributedCacheTestBuilder ContainingEntry(string key, byte[] value);
1919

20+
/// <summary>
21+
/// Tests whether the <see cref="IDistributedCache"/> contains entry with the provided key and corresponding value.
22+
/// </summary>
23+
/// <param name="key">Key of the cache entry.</param>
24+
/// <param name="value">String value of the cache entry.</param>
25+
/// <returns>The same <see cref="IAndDistributedCacheTestBuilder"/>.</returns>
26+
IAndDistributedCacheTestBuilder ContainingEntry(string key, string value);
27+
2028
/// <summary>
2129
/// Tests whether the <see cref="IDistributedCache"/> contains entry with the provided key and corresponding value.
2230
/// </summary>
@@ -26,6 +34,15 @@ public interface IDistributedCacheTestBuilder
2634
/// <returns>The same <see cref="IAndDistributedCacheTestBuilder"/>.</returns>
2735
IAndDistributedCacheTestBuilder ContainingEntry(string key, byte[] value, DistributedCacheEntryOptions options);
2836

37+
/// <summary>
38+
/// Tests whether the <see cref="IDistributedCache"/> contains entry with the provided key and corresponding value.
39+
/// </summary>
40+
/// <param name="key">Key of the cache entry.</param>
41+
/// <param name="value">String value of the cache entry.</param>
42+
/// <param name="options"><see cref="DistributedCacheEntryOptions"/> of the cache entry.</param>
43+
/// <returns>The same <see cref="IAndDistributedCacheTestBuilder"/>.</returns>
44+
IAndDistributedCacheTestBuilder ContainingEntry(string key, string value, DistributedCacheEntryOptions options);
45+
2946
/// <summary>
3047
/// Tests whether the <see cref="IDistributedCache"/> contains specific entry by using a builder.
3148
/// </summary>
@@ -47,12 +64,26 @@ public interface IDistributedCacheTestBuilder
4764
/// <returns>The same <see cref="IAndDistributedCacheTestBuilder"/>.</returns>
4865
IAndDistributedCacheTestBuilder ContainingEntryWithValue(byte[] value);
4966

67+
/// <summary>
68+
/// Tests whether the <see cref="IDistributedCache"/> contains entry with the provided value.
69+
/// </summary>
70+
/// <param name="value">String value of the cache entry.</param>
71+
/// <returns>The same <see cref="IAndDistributedCacheTestBuilder"/>.</returns>
72+
IAndDistributedCacheTestBuilder ContainingEntryWithValue(string value);
73+
5074
/// <summary>
5175
/// Tests whether the <see cref="IDistributedCache"/> contains the provided entries.
5276
/// </summary>
5377
/// <param name="entries">Dictionary of cache entries.</param>
5478
/// <returns>The same <see cref="IAndDistributedCacheTestBuilder"/>.</returns>
5579
IAndDistributedCacheTestBuilder ContainingEntries(IDictionary<string, byte[]> entries);
5680

81+
/// <summary>
82+
/// Tests whether the <see cref="IDistributedCache"/> contains the provided entries.
83+
/// </summary>
84+
/// <param name="entries">Dictionary of cache entries.</param>
85+
/// <returns>The same <see cref="IAndDistributedCacheTestBuilder"/>.</returns>
86+
IAndDistributedCacheTestBuilder ContainingEntries(IDictionary<string, string> entries);
87+
5788
}
5889
}

0 commit comments

Comments
 (0)