Skip to content

Commit

Permalink
Added tests to cover reactivemarbles#668
Browse files Browse the repository at this point in the history
  • Loading branch information
JakenVeina committed Nov 14, 2023
1 parent 76d21d4 commit a1880d0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/DynamicData.Tests/Cache/DisposeManyFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ public void Dispose()
_results.Dispose();
}

[Fact]
// Verifies https://github.com/reactivemarbles/DynamicData/issues/668
public void ErrorsArePropagated()
{
var error = new Exception("Test Exception");

var source = Observable.Throw<IChangeSet<object, object>>(error)
.DisposeMany();

FluentActions.Invoking(() => source.Subscribe()).Should().Throw<Exception>().Which.Should().BeSameAs(error);

var receivedError = null as Exception;
source.Subscribe(
onNext: static _ => { },
onError: error => receivedError = error);
receivedError.Should().BeSameAs(error);
}

[Fact]
public void ItemsAreDisposedAfterRemovalOrReplacement()
{
Expand Down
18 changes: 18 additions & 0 deletions src/DynamicData.Tests/List/DisposeManyFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ public void Dispose()
_results.Dispose();
}

[Fact]
// Verifies https://github.com/reactivemarbles/DynamicData/issues/668
public void ErrorsArePropagated()
{
var error = new Exception("Test Exception");

var source = Observable.Throw<IChangeSet<object>>(error)
.DisposeMany();

FluentActions.Invoking(() => source.Subscribe()).Should().Throw<Exception>().Which.Should().BeSameAs(error);

var receivedError = null as Exception;
source.Subscribe(
onNext: static _ => { },
onError: error => receivedError = error);
receivedError.Should().BeSameAs(error);
}

[Fact]
public void ItemsAreDisposedAfterRemovalOrReplacement()
{
Expand Down

0 comments on commit a1880d0

Please sign in to comment.