-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
ec02c3b
commit 811b32e
Showing
5 changed files
with
74 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Linq; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace DynamicData.Tests.Cache | ||
{ | ||
/// <summary> | ||
/// See https://github.com/reactivemarbles/DynamicData/issues/400 | ||
/// </summary> | ||
public class FilterOnConnectFixture | ||
{ | ||
[Fact] | ||
public void ClearingSourceCacheWithPredicateShouldClearTheData() | ||
{ | ||
// having | ||
var source = new SourceCache<int, int>(it => it); | ||
source.AddOrUpdate(1); | ||
var results = source.Connect(it => true).AsAggregator(); | ||
|
||
// when | ||
source.Clear(); | ||
|
||
// then | ||
results.Data.Count.Should().Be(0, "Should be 0"); | ||
} | ||
|
||
[Fact] | ||
public void UpdatesExistedBeforeConnectWithoutPredicateShouldBeVisibleAsPreviousWhenNewUpdatesTriggered() | ||
{ | ||
// having | ||
var source = new SourceCache<int, int>(it => it); | ||
source.AddOrUpdate(1); | ||
var results = source.Connect().AsAggregator(); | ||
|
||
// when | ||
source.AddOrUpdate(1); | ||
|
||
// then | ||
results.Messages.Count.Should().Be(2, "Should be 2 updates"); | ||
results.Messages[1].First().Previous.HasValue.Should().Be(true, "Should have previous value"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters