Esempio n. 1
0
        public void GroupTest_RefreshItemWithoutGroupKeyChanged()
        {
            using (var cache = new SourceCache <Groupable <int, string>, Guid>(x => x.Key))
                using (var aggregator = cache.Connect()
                                        .Group(x => x.GroupKey)
                                        .AsAggregator())
                {
                    cache.AddOrUpdate(_items);
                    cache.Refresh(_items[0]);

                    Assert.AreEqual(1, aggregator.Messages.Count);
                    EnumerableAssert.None(aggregator.Messages.SelectMany(x => x), x => x.Reason == ChangeReason.Refresh);
                }
        }
Esempio n. 2
0
        public void GroupTest_RefreshGroupsWithoutGroupKeyChanged()
        {
            using (var refresher = new Subject <Unit>())
                using (var cache = new SourceCache <Groupable <int, string>, Guid>(x => x.Key))
                    using (var aggregator = cache.Connect()
                                            .Group(x => x.GroupKey, refresher)
                                            .AsAggregator())
                    {
                        cache.AddOrUpdate(_items);
                        refresher.OnNext(Unit.Default);

                        Assert.AreEqual(1, aggregator.Messages.Count);
                        EnumerableAssert.None(aggregator.Messages.SelectMany(x => x), x => x.Reason == ChangeReason.Refresh);
                    }
        }