-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from reisenberger/v300
Version 3.0.0: For compatibility with (forthcoming) Polly v7.0.0
- Loading branch information
Showing
19 changed files
with
376 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
next-version: 2.0.2 | ||
next-version: 3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
src/Polly.Caching.Memory.SharedSpecs/Integration/CacheRoundTripSpecsBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Polly.Caching.Memory.Specs.Integration | ||
{ | ||
public abstract class CacheRoundTripSpecsBase | ||
{ | ||
protected CacheRoundTripSpecsBase(ICachePolicyFactory cachePolicyFactory) | ||
{ | ||
CachePolicyFactory = cachePolicyFactory; | ||
} | ||
|
||
protected ICachePolicyFactory CachePolicyFactory { get; } | ||
|
||
protected const string OperationKey = "SomeOperationKey"; | ||
|
||
public abstract Task Should_roundtrip_this_variant_of<TResult>(TResult testValue); | ||
|
||
[Theory] | ||
[MemberData(nameof(SampleClassData))] | ||
public async Task Should_roundtrip_all_variants_of_reference_type(SampleClass testValue) | ||
{ | ||
await Should_roundtrip_this_variant_of<SampleClass>(testValue); | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(SampleStringData))] | ||
public async Task Should_roundtrip_all_variants_of_string(String testValue) | ||
{ | ||
await Should_roundtrip_this_variant_of<String>(testValue); | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(SampleNumericData))] | ||
public async Task Should_roundtrip_all_variants_of_numeric(int testValue) | ||
{ | ||
await Should_roundtrip_this_variant_of<int>(testValue); | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(SampleEnumData))] | ||
public async Task Should_roundtrip_all_variants_of_enum(SampleEnum testValue) | ||
{ | ||
await Should_roundtrip_this_variant_of<SampleEnum>(testValue); | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(SampleBoolData))] | ||
public async Task Should_roundtrip_all_variants_of_bool(bool testValue) | ||
{ | ||
await Should_roundtrip_this_variant_of<bool>(testValue); | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(SampleNullableBoolData))] | ||
public async Task Should_roundtrip_all_variants_of_nullable_bool(bool? testValue) | ||
{ | ||
await Should_roundtrip_this_variant_of<bool?>(testValue); | ||
} | ||
|
||
public static TheoryData<SampleClass> SampleClassData => | ||
new TheoryData<SampleClass> | ||
{ | ||
new SampleClass(), | ||
new SampleClass() | ||
{ | ||
StringProperty = "<html></html>", | ||
IntProperty = 1 | ||
}, | ||
(SampleClass)null, | ||
default(SampleClass) | ||
}; | ||
|
||
public static TheoryData<String> SampleStringData => | ||
new TheoryData<String> | ||
{ | ||
"some string", | ||
"", | ||
null, | ||
default(string), | ||
"null" | ||
}; | ||
|
||
public static TheoryData<int> SampleNumericData => | ||
new TheoryData<int> | ||
{ | ||
-1, | ||
0, | ||
1, | ||
default(int) | ||
}; | ||
|
||
public static TheoryData<SampleEnum> SampleEnumData => | ||
new TheoryData<SampleEnum> | ||
{ | ||
SampleEnum.FirstValue, | ||
SampleEnum.SecondValue, | ||
default(SampleEnum), | ||
}; | ||
|
||
public static TheoryData<bool> SampleBoolData => | ||
new TheoryData<bool> | ||
{ | ||
true, | ||
false, | ||
default(bool), | ||
}; | ||
|
||
public static TheoryData<bool?> SampleNullableBoolData => | ||
new TheoryData<bool?> | ||
{ | ||
true, | ||
false, | ||
null, | ||
default(bool?), | ||
}; | ||
|
||
public class SampleClass | ||
{ | ||
public string StringProperty { get; set; } | ||
public int IntProperty { get; set; } | ||
} | ||
|
||
public enum SampleEnum | ||
{ | ||
FirstValue, | ||
SecondValue, | ||
} | ||
} | ||
} |
Oops, something went wrong.