Ejemplo n.º 1
0
        /// <summary>
        /// If these ones fail, one should consider to kill him/herself and never touch keyboard again!
        /// </summary>
        public void BasicTests()
        {
            Assert.AreEqual(_materializedSeries.Count, _testSeries.Count());
            Assert.AreEqual(_materializedSeries.First.IsMissing, !_testSeries.Any());
            Assert.AreEqual(_materializedSeries.IsCompleted, _testSeries.IsCompleted);
            if (_materializedSeries.Count == 0)
            {
                return;
            }
            Assert.AreEqual(_materializedSeries.First, _testSeries.First());
            Assert.AreEqual(_materializedSeries.Last, _testSeries.Last());

            foreach (var kvp in _materializedSeries)
            {
                KeyValuePair <K, V> tkvp;
                if (_testSeries.TryFindAt(kvp.Key, Lookup.EQ, out tkvp))
                {
                    Assert.AreEqual(kvp, tkvp);
                }
            }

            for (int i = 0; i < 1000; i++)
            {
                var idx = _rng.Next(_materializedSeries.Count);
                // TODO (UX) Public cannot get key by index
                _materializedSeries.TryGetAt(idx, out var v);
                var k = _materializedSeries.keys[idx];
                if (_testSeries.TryFindAt(k, Lookup.EQ, out var tv))
                {
                    Assert.AreEqual(v, tv.Value);
                }
            }
        }