-
-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathCacheTests.cs
More file actions
61 lines (54 loc) · 1.92 KB
/
Copy pathCacheTests.cs
File metadata and controls
61 lines (54 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using Xunit;
namespace Dommel.Tests;
public class CacheTests
{
[Theory]
[InlineData(QueryCacheType.Get)]
[InlineData(QueryCacheType.GetByMultipleIds)]
[InlineData(QueryCacheType.GetAll)]
[InlineData(QueryCacheType.Project)]
[InlineData(QueryCacheType.ProjectByMultipleIds)]
[InlineData(QueryCacheType.ProjectAll)]
[InlineData(QueryCacheType.Count)]
[InlineData(QueryCacheType.Insert)]
[InlineData(QueryCacheType.Update)]
[InlineData(QueryCacheType.Delete)]
[InlineData(QueryCacheType.DeleteAll)]
[InlineData(QueryCacheType.Any)]
internal void SetsCache(QueryCacheType queryCacheType)
{
var cacheKey = new QueryCacheKey(queryCacheType, new DummySqlBuilder(), typeof(Foo));
DommelMapper.QueryCache[cacheKey] = "blah";
Assert.Equal("blah", DommelMapper.QueryCache[cacheKey]);
}
[Fact]
public void IsEqual()
{
Assert.Equal(
new QueryCacheKey(QueryCacheType.Get, new DummySqlBuilder(), typeof(Foo)),
new QueryCacheKey(QueryCacheType.Get, new DummySqlBuilder(), typeof(Foo)));
}
[Fact]
public void IsNotEqualCacheType()
{
Assert.NotEqual(
new QueryCacheKey(QueryCacheType.Get, new DummySqlBuilder(), typeof(Foo)),
new QueryCacheKey(QueryCacheType.GetAll, new DummySqlBuilder(), typeof(Foo)));
}
[Fact]
public void IsNotEqualBuilderType()
{
Assert.NotEqual(
new QueryCacheKey(QueryCacheType.Get, new SqlServerSqlBuilder(), typeof(Foo)),
new QueryCacheKey(QueryCacheType.Get, new DummySqlBuilder(), typeof(Foo)));
}
[Fact]
public void IsNotEqualEntityType()
{
Assert.NotEqual(
new QueryCacheKey(QueryCacheType.Get, new DummySqlBuilder(), typeof(Foo)),
new QueryCacheKey(QueryCacheType.Get, new DummySqlBuilder(), typeof(Bar)));
}
private class Foo { }
private class Bar { }
}