Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: #269 Least effort implementation of a clearable Architecture cache #270

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ArchUnitNET/Domain/ArchitectureCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ public bool Add(ArchitectureCacheKey architectureCacheKey, Architecture architec
{
return Cache.TryAdd(architectureCacheKey, architecture);
}

public void Clear() => Cache.Clear();
}
}
12 changes: 12 additions & 0 deletions ArchUnitNETTests/Domain/ArchitectureCacheTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
5 changes: 0 additions & 5 deletions ArchUnitNETTests/Domain/TestArchitectureCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,5 @@ public int Size()
{
return Cache.Count;
}

public void Clear()
{
Cache.Clear();
}
}
}
Loading