Skip to content

Duplication of events AddOrUpdate() #695

Closed Answered by RolandPheasant
FoxTes asked this question in Q&A
Discussion options

You must be logged in to vote

I cannot replicate. This unit test passes.

    public record DaysRange(Guid Id, DateTime? Start = null);

    [Fact]
    public void CannotReplicate()
    {
        int count = 0;

        var daysRanges = new SourceCache<DaysRange, Guid>(daysRange => daysRange.Id);
        daysRanges.AddOrUpdate(new DaysRange(Guid.Empty));
        daysRanges.Connect()
            .Do(_=> count++)
            .Sort(SortExpressionComparer<DaysRange>.Ascending(t => t.Start ?? DateTime.MaxValue))
            .Bind(out var list )
            .DisposeMany()
            .Subscribe();

        count.Should().Be(1);
    }

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by FoxTes
Comment options

You must be logged in to vote
2 replies
@RolandPheasant
Comment options

@FoxTes
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants