Skip to content

Commit

Permalink
Merge pull request #134 from robsonj/master
Browse files Browse the repository at this point in the history
#128 - Filter(reapplyFilter) throws an ArgumentNullException
  • Loading branch information
RolandPheasant committed Jul 13, 2018
2 parents 9c2ab0d + e556db9 commit 9d25a09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions DynamicData.Tests/Cache/FilterControllerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ public void ChangeFilter()
_results.Data.Items.All(p => p.Age <= 50).Should().BeTrue();
}

[Fact]
public void ReapplyFilterDoesntThrow()
{
using (var source = new SourceCache<Person, string>(p => p.Key))
{
source.AddOrUpdate(Enumerable.Range(1, 100).Select(i => new Person("P" + i, i)).ToArray());

var ex = Record.Exception(() => source.Connect()
.Filter(Observable.Return(Unit.Default))
.AsObservableCache());
Assert.Null(ex);
}
}

[Fact]
public void RepeatedApply()
{
Expand Down
3 changes: 2 additions & 1 deletion DynamicData/Cache/ObservableCacheEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,8 @@ public static IObservable<IReadOnlyCollection<T>> StartWithEmpty<T>(this IObserv
{
if (source == null) throw new ArgumentNullException(nameof(source));
if (reapplyFilter == null) throw new ArgumentNullException(nameof(reapplyFilter));
return new DynamicFilter<TObject, TKey>(source, null, reapplyFilter).Run();
var empty = Observable.Empty<Func<TObject, bool>>();
return new DynamicFilter<TObject, TKey>(source, empty, reapplyFilter).Run();
}


Expand Down

0 comments on commit 9d25a09

Please sign in to comment.