Skip to content

Commit 8a6934a

Browse files
committed
refactor: streamline resource disposal and improve test file handling in DependencyGraphGeneratorTests and JsonHandlerTests
1 parent 2c20567 commit 8a6934a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CodeLineCounter.Tests/DependencyGraphGeneratorTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ public DependencyGraphGeneratorTests()
2222
[Fact]
2323
public async Task generate_graph_with_valid_dependencies_creates_dot_file()
2424
{
25+
var testDirectory = _testDirectory;
26+
string fileName = "testgraph.dot";
2527
using (var sw = new StringWriter())
2628
{
27-
var testDirectory = _testDirectory;
28-
string fileName = "testgraph.dot";
29+
2930
// Arrange
3031
var dependencies = new List<DependencyRelation>
3132
{

CodeLineCounter.Tests/JsonHandlerTests.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,15 @@ protected virtual void Dispose(bool disposing)
6161
{
6262
if (!_disposed)
6363
{
64-
if (disposing && Directory.Exists(_testDirectory))
64+
if (disposing)
6565
{
66-
// Dispose managed resources
67-
Directory.Delete(_testDirectory, true);
66+
Task.Delay(100).Wait();
67+
68+
if (Directory.Exists(_testDirectory))
69+
{
70+
// Dispose managed resources
71+
Directory.Delete(_testDirectory, true);
72+
}
6873
}
6974

7075
// Dispose unmanaged resources (if any)

0 commit comments

Comments
 (0)