-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathArchitectureCacheTests.cs
More file actions
48 lines (41 loc) · 1.56 KB
/
ArchitectureCacheTests.cs
File metadata and controls
48 lines (41 loc) · 1.56 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
using System.Collections.Generic;
using ArchUnitNET.Domain;
using Xunit;
namespace ArchUnitNETTests.Domain
{
public class ArchitectureCacheTests
{
private readonly TestArchitectureCache _testArchitectureCache;
private readonly ArchitectureCacheKey _testArchitectureCacheKey;
private readonly Architecture _testEmptyArchitecture;
public ArchitectureCacheTests()
{
_testArchitectureCache = new TestArchitectureCache();
_testArchitectureCacheKey = new ArchitectureCacheKey();
_testArchitectureCacheKey.Add(typeof(ArchitectureCacheTests).Assembly.FullName, null);
_testEmptyArchitecture = new Architecture(
new List<Assembly>(),
new List<Namespace>(),
new List<IType>(),
new List<GenericParameter>(),
new List<IType>()
);
}
[Fact]
public void DuplicateArchitectureDetected()
{
_testArchitectureCache.Add(_testArchitectureCacheKey, _testEmptyArchitecture);
_testArchitectureCache.Add(_testArchitectureCacheKey, _testEmptyArchitecture);
Assert.True(_testArchitectureCache.Size() == 1);
}
[Fact]
public void GetExistingArchitecture()
{
_testArchitectureCache.Add(_testArchitectureCacheKey, _testEmptyArchitecture);
Assert.Equal(
_testArchitectureCache.TryGetArchitecture(_testArchitectureCacheKey),
_testEmptyArchitecture
);
}
}
}