diff --git a/ArchUnitNET/Domain/ArchitectureCache.cs b/ArchUnitNET/Domain/ArchitectureCache.cs index 310a7560..1a371d1a 100644 --- a/ArchUnitNET/Domain/ArchitectureCache.cs +++ b/ArchUnitNET/Domain/ArchitectureCache.cs @@ -28,5 +28,7 @@ public bool Add(ArchitectureCacheKey architectureCacheKey, Architecture architec { return Cache.TryAdd(architectureCacheKey, architecture); } + + public void Clear() => Cache.Clear(); } } diff --git a/ArchUnitNETTests/Domain/ArchitectureCacheTests.cs b/ArchUnitNETTests/Domain/ArchitectureCacheTests.cs index 2613121f..f53e9b33 100644 --- a/ArchUnitNETTests/Domain/ArchitectureCacheTests.cs +++ b/ArchUnitNETTests/Domain/ArchitectureCacheTests.cs @@ -50,5 +50,17 @@ public void GetExistingArchitecture() _testEmptyArchitecture ); } + + [Fact] + public void CacheClear() + { + _testArchitectureCache.Add(_testArchitectureCacheKey, _testEmptyArchitecture); + Assert.Equal( + _testArchitectureCache.TryGetArchitecture(_testArchitectureCacheKey), + _testEmptyArchitecture + ); + _testArchitectureCache.Clear(); + Assert.Null(_testArchitectureCache.TryGetArchitecture(_testArchitectureCacheKey)); + } } } diff --git a/ArchUnitNETTests/Domain/TestArchitectureCache.cs b/ArchUnitNETTests/Domain/TestArchitectureCache.cs index a356d31c..ee2c4a89 100644 --- a/ArchUnitNETTests/Domain/TestArchitectureCache.cs +++ b/ArchUnitNETTests/Domain/TestArchitectureCache.cs @@ -14,10 +14,5 @@ public int Size() { return Cache.Count; } - - public void Clear() - { - Cache.Clear(); - } } }