Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed Jan 28, 2025
1 parent aba7e55 commit 78d7802
Showing 1 changed file with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions Speckle.Connectors.Common.Tests/CancellationManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@ public void CancelOne()

var id = Guid.NewGuid().ToString();
var item = manager.GetCancellationItem(id);

manager.NumberOfOperations.Should().Be(1);
manager.IsExist(id).Should().BeTrue();
manager.CancelOperation(id);
item.Token.IsCancellationRequested.Should().BeTrue();
manager.IsCancellationRequested(id).Should().BeTrue();
manager.IsExist(id).Should().BeTrue();
item.Dispose();



manager.NumberOfOperations.Should().Be(1);
manager.IsExist(id).Should().BeTrue();
manager.CancelOperation(id);
item.Token.IsCancellationRequested.Should().BeTrue();
manager.IsCancellationRequested(id).Should().BeTrue();
manager.IsExist(id).Should().BeTrue();
item.Dispose();

manager.IsExist(id).Should().BeFalse();
Assert.Throws<KeyNotFoundException>(() => item.Token.IsCancellationRequested.Should().BeTrue());
Assert.Throws<KeyNotFoundException>(() => manager.IsCancellationRequested(id).Should().BeTrue());
Assert.Throws<KeyNotFoundException>(() => item.Token.IsCancellationRequested.Should().BeTrue());

Assert.Throws<KeyNotFoundException>(() => manager.IsCancellationRequested(id).Should().BeTrue());
}

[Test]
public void CancelTwo()
{
Expand All @@ -40,36 +39,34 @@ public void CancelTwo()
var id2 = Guid.NewGuid().ToString();
var item1 = manager.GetCancellationItem(id1);
var item2 = manager.GetCancellationItem(id2);

manager.NumberOfOperations.Should().Be(2);
manager.IsExist(id1).Should().BeTrue();
manager.CancelOperation(id1);
item1.Token.IsCancellationRequested.Should().BeTrue();
manager.IsCancellationRequested(id1).Should().BeTrue();
manager.IsExist(id1).Should().BeTrue();
item1.Dispose();

manager.IsExist(id1).Should().BeFalse();
Assert.Throws<KeyNotFoundException>(() => item1.Token.IsCancellationRequested.Should().BeTrue());
Assert.Throws<KeyNotFoundException>(() => manager.IsCancellationRequested(id1).Should().BeTrue());
Assert.Throws<KeyNotFoundException>(() => item1.Token.IsCancellationRequested.Should().BeTrue());

Assert.Throws<KeyNotFoundException>(() => manager.IsCancellationRequested(id1).Should().BeTrue());

manager.NumberOfOperations.Should().Be(1);
manager.IsExist(id2).Should().BeTrue();
manager.CancelOperation(id2);
item2.Token.IsCancellationRequested.Should().BeTrue();
manager.IsCancellationRequested(id2).Should().BeTrue();
manager.IsExist(id2).Should().BeTrue();
item2.Dispose();

manager.IsExist(id2).Should().BeFalse();
Assert.Throws<KeyNotFoundException>(() => item2.Token.IsCancellationRequested.Should().BeTrue());

Assert.Throws<KeyNotFoundException>(() => manager.IsCancellationRequested(id2).Should().BeTrue());
Assert.Throws<KeyNotFoundException>(() => item2.Token.IsCancellationRequested.Should().BeTrue());

Assert.Throws<KeyNotFoundException>(() => manager.IsCancellationRequested(id2).Should().BeTrue());
}



[Test]
public void CancelAll()
{
Expand All @@ -80,7 +77,7 @@ public void CancelAll()
var id2 = Guid.NewGuid().ToString();
var item1 = manager.GetCancellationItem(id1);
var item2 = manager.GetCancellationItem(id2);

manager.NumberOfOperations.Should().Be(2);
manager.IsExist(id1).Should().BeTrue();
manager.CancelAllOperations();
Expand All @@ -92,7 +89,7 @@ public void CancelAll()
manager.IsExist(id2).Should().BeTrue();
item1.Dispose();
item2.Dispose();

manager.IsExist(id1).Should().BeFalse();
manager.IsExist(id2).Should().BeFalse();
}
Expand Down

0 comments on commit 78d7802

Please sign in to comment.