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++}"); }); }
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++}"); }); }
public void Empty_IEnumerable___empty_result() { var sut = new NoCompression(); var data = Empty(); var iterator = sut.Process(data).GetEnumerator(); Assert.IsFalse(iterator.MoveNext()); }
public void MoveNext_without_GetEnumerator___throws_InvalidOperation() { var sut = new NoCompression(); var data = RawDataForTrend(); var iterator = sut.Process(data); Assert.Throws <InvalidOperationException>(() => iterator.MoveNext()); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }