Beispiel #1
0
        public void Known_sequence_as_array___correct_result()
        {
            var sut      = new NoCompression();
            var data     = KnownSequence().ToArray();
            var iterator = sut.Process(data).GetEnumerator();
            var expected = KnownSequence().ToArray();

            Assert.Multiple(() =>
            {
                int step = 0;
                Assert.IsTrue(iterator.MoveNext(), $"MoveNext step: {step}");
                Assert.AreEqual(expected[step], iterator.Current, $"Equal step: {step}");
                step++;
                Assert.IsTrue(iterator.MoveNext(), $"MoveNext step: {step}");
                Assert.AreEqual(expected[step], iterator.Current, $"Equal step: {step}");
                step++;
                Assert.IsTrue(iterator.MoveNext(), $"MoveNext step: {step}");
                Assert.AreEqual(expected[step], iterator.Current, $"Equal step: {step}");
                step++;
                Assert.IsTrue(iterator.MoveNext(), $"MoveNext step: {step}");
                Assert.AreEqual(expected[step], iterator.Current, $"Equal step: {step}");
                step++;
                Assert.IsTrue(iterator.MoveNext(), $"MoveNext step: {step}");
                Assert.AreEqual(expected[step], iterator.Current, $"Equal step: {step}");
                step++;
                Assert.IsFalse(iterator.MoveNext(), $"MoveNext step: {step++}");
            });
        }
Beispiel #2
0
        public void Cloning_iterates_over_fresh_set()
        {
            var sut      = new NoCompression();
            var data     = KnownSequence().ToArray().Select(dp => dp);
            var expected = KnownSequence().ToArray();
            var filter   = sut.Process(data);

            var iterator = filter.GetEnumerator();

            iterator.MoveNext();

            iterator = filter.Clone().GetEnumerator();

            Assert.Multiple(() =>
            {
                int step = 0;
                Assert.IsTrue(iterator.MoveNext(), $"MoveNext step: {step}");
                Assert.AreEqual(expected[step], iterator.Current, $"Equal step: {step}");
                step++;
                Assert.IsTrue(iterator.MoveNext(), $"MoveNext step: {step}");
                Assert.AreEqual(expected[step], iterator.Current, $"Equal step: {step}");
                step++;
                Assert.IsTrue(iterator.MoveNext(), $"MoveNext step: {step}");
                Assert.AreEqual(expected[step], iterator.Current, $"Equal step: {step}");
                step++;
                Assert.IsFalse(iterator.MoveNext(), $"MoveNext step: {step++}");
            });
        }
Beispiel #3
0
        public void Empty_IEnumerable___empty_result()
        {
            var sut      = new NoCompression();
            var data     = Empty();
            var iterator = sut.Process(data).GetEnumerator();

            Assert.IsFalse(iterator.MoveNext());
        }
Beispiel #4
0
        public void MoveNext_without_GetEnumerator___throws_InvalidOperation()
        {
            var sut  = new NoCompression();
            var data = RawDataForTrend();

            var iterator = sut.Process(data);

            Assert.Throws <InvalidOperationException>(() => iterator.MoveNext());
        }
Beispiel #5
0
        public void One_DataPoint_IEnumerable___OK()
        {
            var sut      = new NoCompression();
            var data     = RawDataForMaxDelta().Take(1);
            var expected = RawDataForMaxDelta().Take(1).ToList();

            var actual = sut.Process(data).ToList();

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #6
0
        public void Data_IList_with_maxDeltaX___OK()
        {
            var sut      = new NoCompression();
            var data     = RawDataForMaxDelta().ToList().AsReadOnly();
            var expected = RawDataForMaxDelta().ToList();

            var actual = sut.Process(data).ToList();

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #7
0
        public void Data_given_as_IList___OK()
        {
            var sut      = new NoCompression();
            var data     = RawDataForTrend().ToList().AsReadOnly();
            var expected = RawDataForTrend().ToList();

            var actual = sut.Process(data).ToList();

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #8
0
        public void Two_DataPoint_IList___OK()
        {
            var sut      = new NoCompression();
            var data     = RawDataForMaxDelta().Take(2).ToList().AsReadOnly();
            var expected = RawDataForMaxDelta().Take(2).ToList();

            var actual = sut.Process(data).ToArray();

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #9
0
        public void One_DataPoint_IEnumerable___OK()
        {
            var sut      = new NoCompression();
            var data     = KnownSequence().Take(1);
            var expected = KnownSequence().Take(1).ToList();

            var actual = new List<DataPoint>();
            foreach (DataPoint dp in sut.Process(data))
                actual.Add(dp);

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #10
0
        public void Data_IList_with_maxDeltaX___OK()
        {
            var sut      = new NoCompression();
            var data     = RawDataForMaxDelta().ToList().AsReadOnly();
            var expected = RawDataForMaxDelta().ToList();

            var actual = new List<DataPoint>();
            foreach (DataPoint dp in sut.Process(data))
                actual.Add(dp);

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #11
0
        public void Data_given_as_List___OK()
        {
            var sut      = new NoCompression();
            var data     = RawDataForTrend().ToList();
            var expected = RawDataForTrend().ToList();

            var actual = new List<DataPoint>();
            foreach (DataPoint dp in sut.Process(data))
                actual.Add(dp);

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #12
0
        public void Empty_IEnumerable_foreach___empty_result()
        {
            var sut  = new NoCompression();
            var data = Empty();

            int count = 0;

            foreach (DataPoint dp in sut.Process(data))
            {
                count++;
            }

            Assert.AreEqual(0, count);
        }
Beispiel #13
0
        public void Two_DataPoint_List___OK()
        {
            var sut      = new NoCompression();
            var data     = RawDataForMaxDelta().Take(2).ToList();
            var expected = RawDataForMaxDelta().Take(2).ToList();

            var actual = new List <DataPoint>();

            foreach (DataPoint dp in sut.Process(data))
            {
                actual.Add(dp);
            }

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #14
0
        public void Known_sequence_as_array_foreach___correct_result()
        {
            var sut      = new NoCompression();
            var data     = KnownSequence().ToArray();
            var result   = sut.Process(data);
            var expected = KnownSequence().ToArray();
            var actual   = new List <DataPoint>();

            foreach (DataPoint dp in result)
            {
                actual.Add(dp);
            }

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #15
0
        public void Two_DataPoint_IList___OK()
        {
            var sut      = new NoCompression();
            var data     = KnownSequence().Take(2).ToList().AsReadOnly();
            var expected = KnownSequence().Take(2).ToList();

            var actual = new List <DataPoint>();

            foreach (DataPoint dp in sut.Process(data))
            {
                actual.Add(dp);
            }

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #16
0
        public void List_iterated_and_ToList___OK()
        {
            var sut      = new NoCompression();
            var data     = RawDataForTrend().ToList();
            var expected = RawDataForTrend().ToList();

            DataPointIterator dataPointIterator = sut.Process(data);

            DataPointIterator enumerator = dataPointIterator.GetEnumerator();

            enumerator.MoveNext();
            enumerator.MoveNext();
            var actual = dataPointIterator.ToList();

            CollectionAssert.AreEqual(expected, actual);
        }