Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/DynamicData.Tests/Cache/BatchIfFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace DynamicData.Tests.Cache;

public partial class BatchIfFixture : IDisposable
{
private readonly ISubject<bool> _pausingSubject = new Subject<bool>();
private readonly Subject<bool> _pausingSubject = new();

private readonly ChangeSetAggregator<Person, string> _results;

Expand Down Expand Up @@ -104,6 +104,7 @@ public void Dispose()
{
_results.Dispose();
_source.Dispose();
_pausingSubject.Dispose();
}

[Fact]
Expand Down
3 changes: 2 additions & 1 deletion src/DynamicData.Tests/Cache/BatchIfWithTimeOutFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void Timeout()

public class BatchIfWithTimeOutFixture : IDisposable
{
private readonly ISubject<bool> _pausingSubject = new Subject<bool>();
private readonly Subject<bool> _pausingSubject = new();

private readonly ChangeSetAggregator<Person, string> _results;

Expand Down Expand Up @@ -115,6 +115,7 @@ public void Dispose()
_results.Dispose();
_source.Dispose();
_pausingSubject.OnCompleted();
_pausingSubject.Dispose();
}

[Fact]
Expand Down
3 changes: 2 additions & 1 deletion src/DynamicData.Tests/Cache/GroupControllerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class GroupControllerFixture : IDisposable
return p.Age <= 60 ? AgeBracket.Adult : AgeBracket.Pensioner;
};

private readonly ISubject<Unit> _refresher;
private readonly Subject<Unit> _refresher;

private readonly ISourceCache<Person, string> _source;

Expand All @@ -38,6 +38,7 @@ public void Dispose()
{
_source?.Dispose();
_grouped?.Dispose();
_refresher.Dispose();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class GroupControllerForFilteredItemsFixture : IDisposable
return p.Age <= 60 ? AgeBracket.Adult : AgeBracket.Pensioner;
};

private readonly ISubject<Unit> _refreshSubject = new Subject<Unit>();
private readonly Subject<Unit> _refreshSubject = new();

private readonly ISourceCache<Person, string> _source;

Expand All @@ -38,6 +38,7 @@ public void Dispose()
{
_source.Dispose();
_grouped.Dispose();
_refreshSubject.Dispose();
}

[Fact]
Expand Down
8 changes: 6 additions & 2 deletions src/DynamicData.Tests/Cache/MergeManyFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,20 @@ public void RemovedItemWillNotCauseInvocation()
stream.Dispose();
}

private class ObjectWithObservable(int id)
private sealed class ObjectWithObservable(int id)
: IDisposable
{
private readonly ISubject<bool> _changed = new Subject<bool>();
private readonly Subject<bool> _changed = new();

private bool _value;

public int Id { get; } = id;

public IObservable<bool> Observable => _changed.AsObservable();

public void Dispose()
=> _changed.Dispose();

public void InvokeObservable(bool value)
{
_value = value;
Expand Down
8 changes: 6 additions & 2 deletions src/DynamicData.Tests/Cache/MergeManyItemsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,20 @@ public void RemovedItemWillNotCauseInvocation()
stream.Dispose();
}

private class ObjectWithObservable(int id)
private sealed class ObjectWithObservable(int id)
: IDisposable
{
private readonly ISubject<bool> _changed = new Subject<bool>();
private readonly Subject<bool> _changed = new();

private bool _value;

public int Id { get; } = id;

public IObservable<bool> Observable => _changed.AsObservable();

public void Dispose()
=> _changed.Dispose();

public void InvokeObservable(bool value)
{
_value = value;
Expand Down
10 changes: 7 additions & 3 deletions src/DynamicData.Tests/Cache/MergeManyWithKeyOverloadFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ public void MergedStreamFailsWhenSourceFails()
receivedError.Should().Be(expectedError);
}

private class ObjectWithObservable(int id)
private sealed class ObjectWithObservable(int id)
: IDisposable
{
private readonly ISubject<bool> _changed = new Subject<bool>();
private readonly Subject<bool> _changed = new();

private bool _value;

Expand All @@ -188,8 +189,11 @@ private class ObjectWithObservable(int id)

public void CompleteObservable() => _changed.OnCompleted();

public void FailObservable(Exception ex) => _changed.OnError(ex);
public void Dispose()
=> _changed.Dispose();

public void FailObservable(Exception ex) => _changed.OnError(ex);

public void InvokeObservable(bool value)
{
_value = value;
Expand Down
6 changes: 4 additions & 2 deletions src/DynamicData.Tests/Cache/PageFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class PageFixture : IDisposable

private readonly RandomPersonGenerator _generator = new();

private readonly ISubject<IPageRequest> _pager;
private readonly BehaviorSubject<IPageRequest> _pager;

private readonly ISubject<IComparer<Person>> _sort;
private readonly BehaviorSubject<IComparer<Person>> _sort;

private readonly ISourceCache<Person, string> _source;

Expand Down Expand Up @@ -56,6 +56,8 @@ public void Dispose()
{
_source.Dispose();
_aggregators.Dispose();
_pager.Dispose();
_sort.Dispose();
}

[Fact]
Expand Down
3 changes: 2 additions & 1 deletion src/DynamicData.Tests/Cache/SortAndPageAndBindFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public abstract class SortAndPageAndBindFixtureBase : IDisposable

protected readonly SourceCache<Person, string> Source = new(p => p.Name);
protected readonly IComparer<Person> Comparer = SortExpressionComparer<Person>.Ascending(p => p.Age).ThenByAscending(p => p.Name);
protected readonly ISubject<IPageRequest> PageRequests = new BehaviorSubject<IPageRequest>(new PageRequest(0, 25));
protected readonly BehaviorSubject<IPageRequest> PageRequests = new(new PageRequest(0, 25));

protected readonly ChangeSetAggregator<Person, string> Aggregator;
protected readonly IList<Person> List;
Expand Down Expand Up @@ -375,5 +375,6 @@ public void Dispose()
Source.Dispose();
Aggregator.Dispose();
PageRequests.OnCompleted();
PageRequests.Dispose();
}
}
3 changes: 2 additions & 1 deletion src/DynamicData.Tests/Cache/SortAndPageFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public abstract class SortAndPageFixtureBase : IDisposable

protected readonly SourceCache<Person, string> Source = new(p => p.Name);
protected readonly IComparer<Person> Comparer = SortExpressionComparer<Person>.Ascending(p => p.Age).ThenByAscending(p => p.Name);
protected readonly ISubject<IPageRequest> PageRequests = new BehaviorSubject<IPageRequest>(new PageRequest(1, 25));
protected readonly BehaviorSubject<IPageRequest> PageRequests = new(new PageRequest(1, 25));

protected readonly ChangeSetAggregator<Person, string, PageContext<Person>> Aggregator;

Expand Down Expand Up @@ -410,5 +410,6 @@ public void Dispose()
Source.Dispose();
Aggregator.Dispose();
PageRequests.OnCompleted();
PageRequests.Dispose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public abstract class SortAndVirtualizeAndBindFixtureBase : IDisposable

protected readonly SourceCache<Person, string> Source = new(p => p.Name);
protected readonly IComparer<Person> Comparer = SortExpressionComparer<Person>.Ascending(p => p.Age).ThenByAscending(p => p.Name);
protected readonly ISubject<IVirtualRequest> VirtualRequests = new BehaviorSubject<IVirtualRequest>(new VirtualRequest(0, 25));
protected readonly BehaviorSubject<IVirtualRequest> VirtualRequests = new(new VirtualRequest(0, 25));

protected readonly ChangeSetAggregator<Person, string> Aggregator;
protected readonly IList<Person> List;
Expand Down Expand Up @@ -381,5 +381,6 @@ public void Dispose()
Source.Dispose();
Aggregator.Dispose();
VirtualRequests.OnCompleted();
VirtualRequests.Dispose();
}
}
3 changes: 2 additions & 1 deletion src/DynamicData.Tests/Cache/SortAndVirtualizeFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public abstract class SortAndVirtualizeFixtureBase : IDisposable

protected readonly SourceCache<Person, string> Source = new(p => p.Name);
protected readonly IComparer<Person> Comparer = SortExpressionComparer<Person>.Ascending(p => p.Age).ThenByAscending(p => p.Name);
protected readonly ISubject<IVirtualRequest> VirtualRequests = new BehaviorSubject<IVirtualRequest>(new VirtualRequest(0, 25));
protected readonly BehaviorSubject<IVirtualRequest> VirtualRequests = new(new VirtualRequest(0, 25));

protected readonly ChangeSetAggregator<Person, string, VirtualContext<Person>> Aggregator;

Expand Down Expand Up @@ -388,5 +388,6 @@ public void Dispose()
Source.Dispose();
Aggregator.Dispose();
VirtualRequests.OnCompleted();
VirtualRequests.Dispose();
}
}
8 changes: 6 additions & 2 deletions src/DynamicData.Tests/Cache/TrueForAllFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,20 @@ public void MultipleValuesReturnTrue()
subscribed.Dispose();
}

private class ObjectWithObservable(int id)
private sealed class ObjectWithObservable(int id)
: IDisposable
{
private readonly ISubject<bool> _changed = new Subject<bool>();
private readonly Subject<bool> _changed = new();

public int Id { get; } = id;

public IObservable<bool> Observable => _changed;

public bool Value { get; private set; }

public void Dispose()
=> _changed.Dispose();

public void InvokeObservable(bool value)
{
Value = value;
Expand Down
8 changes: 6 additions & 2 deletions src/DynamicData.Tests/Cache/TrueForAnyFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,20 @@ public void ValuesPublishedOnSubscriptionDoNotTriggerPrematureOutput()
results.RecordedValues[0].Should().Be(true, because: "One of the two items in the source has a true value");
}

private class ObjectWithObservable(int id)
private sealed class ObjectWithObservable(int id)
: IDisposable
{
private readonly ISubject<bool> _changed = new Subject<bool>();
private readonly Subject<bool> _changed = new();

public int Id { get; } = id;

public IObservable<bool> Observable => _changed;

public bool Value { get; private set; }

public void Dispose()
=> _changed.Dispose();

public void InvokeObservable(bool value)
{
Value = value;
Expand Down
3 changes: 2 additions & 1 deletion src/DynamicData.Tests/List/BatchIfFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace DynamicData.Tests.List;

public class BatchIfFixture : IDisposable
{
private readonly ISubject<bool> _pausingSubject = new Subject<bool>();
private readonly Subject<bool> _pausingSubject = new();

private readonly ChangeSetAggregator<Person> _results;

Expand Down Expand Up @@ -86,6 +86,7 @@ public void Dispose()
{
_results.Dispose();
_source.Dispose();
_pausingSubject.Dispose();
}

[Fact]
Expand Down
3 changes: 2 additions & 1 deletion src/DynamicData.Tests/List/BatchIfWithTimeOutFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace DynamicData.Tests.List;

public class BatchIfWithTimeOutFixture : IDisposable
{
private readonly ISubject<bool> _pausingSubject = new Subject<bool>();
private readonly Subject<bool> _pausingSubject = new();

private readonly ChangeSetAggregator<Person> _results;

Expand Down Expand Up @@ -43,6 +43,7 @@ public void Dispose()
_results.Dispose();
_source.Dispose();
_pausingSubject.OnCompleted();
_pausingSubject.Dispose();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace DynamicData.Tests.List;

public class FilterControllerFixtureWithClearAndReplace : IDisposable
{
private readonly ISubject<Func<Person, bool>> _filter;
private readonly BehaviorSubject<Func<Person, bool>> _filter;

private readonly ChangeSetAggregator<Person> _results;

Expand Down Expand Up @@ -139,6 +139,7 @@ public void Dispose()
{
_source.Dispose();
_results.Dispose();
_filter.Dispose();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace DynamicData.Tests.List;

public class FilterControllerFixtureWithDiffSet : IDisposable
{
private readonly ISubject<Func<Person, bool>> _filter;
private readonly BehaviorSubject<Func<Person, bool>> _filter;

private readonly ChangeSetAggregator<Person> _results;

Expand Down Expand Up @@ -139,6 +139,7 @@ public void Dispose()
{
_source.Dispose();
_results.Dispose();
_filter.Dispose();
}

[Fact]
Expand Down
3 changes: 2 additions & 1 deletion src/DynamicData.Tests/List/GroupImmutableFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class GroupImmutableFixture : IDisposable
{
private readonly ISubject<Unit> _regrouper;
private readonly Subject<Unit> _regrouper;

private readonly ChangeSetAggregator<DynamicData.List.IGrouping<Person, int>> _results;

Expand Down Expand Up @@ -55,6 +55,7 @@ public void Dispose()
{
_source.Dispose();
_results.Dispose();
_regrouper.Dispose();
}

[Fact]
Expand Down
Loading
Loading