|
| 1 | +using System.Collections.ObjectModel; |
1 | 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
2 | 3 | using Skender.Stock.Indicators; |
3 | 4 |
|
@@ -64,14 +65,39 @@ public void QuoteToTuple() |
64 | 65 | NullMath.Round(q.ToTuple(CandlePart.OHLC4).value, 10)); |
65 | 66 |
|
66 | 67 | // bad argument |
67 | | - Assert.ThrowsException<ArgumentOutOfRangeException>(() => |
| 68 | + _ = Assert.ThrowsException<ArgumentOutOfRangeException>(() => |
68 | 69 | q.ToTuple((CandlePart)999)); |
69 | 70 |
|
70 | 71 | // bad argument |
71 | | - Assert.ThrowsException<ArgumentOutOfRangeException>(() => |
| 72 | + _ = Assert.ThrowsException<ArgumentOutOfRangeException>(() => |
72 | 73 | q.ToBasicData((CandlePart)999)); |
73 | 74 | } |
74 | 75 |
|
| 76 | + [TestMethod] |
| 77 | + public void ToTupleCollection() |
| 78 | + { |
| 79 | + Collection<(DateTime, double)> collection = quotes |
| 80 | + .OrderBy(x => x.Date) |
| 81 | + .ToTupleCollection(CandlePart.Close); |
| 82 | + |
| 83 | + Assert.IsNotNull(collection); |
| 84 | + Assert.AreEqual(502, collection.Count); |
| 85 | + Assert.AreEqual(collection.LastOrDefault().Item2, 245.28d); |
| 86 | + } |
| 87 | + |
| 88 | + [TestMethod] |
| 89 | + public void ToSortedList() |
| 90 | + { |
| 91 | + Collection<(DateTime, double)> collection = quotes |
| 92 | + .OrderBy(x => x.Date) |
| 93 | + .ToTuple(CandlePart.Close) |
| 94 | + .ToSortedCollection(); |
| 95 | + |
| 96 | + Assert.IsNotNull(collection); |
| 97 | + Assert.AreEqual(502, collection.Count); |
| 98 | + Assert.AreEqual(collection.LastOrDefault().Item2, 245.28d); |
| 99 | + } |
| 100 | + |
75 | 101 | [TestMethod] |
76 | 102 | public void QuoteToBasicData() |
77 | 103 | { |
@@ -130,7 +156,7 @@ public void QuoteToBasicData() |
130 | 156 | NullMath.Round(q.ToBasicData(CandlePart.OHLC4).Value, 10)); |
131 | 157 |
|
132 | 158 | // bad argument |
133 | | - Assert.ThrowsException<ArgumentOutOfRangeException>(() => |
| 159 | + _ = Assert.ThrowsException<ArgumentOutOfRangeException>(() => |
134 | 160 | q.ToBasicData((CandlePart)999)); |
135 | 161 | } |
136 | 162 |
|
@@ -192,7 +218,7 @@ public void QuoteDToTuple() |
192 | 218 | NullMath.Round(q.ToTuple(CandlePart.OHLC4).Item2, 10)); |
193 | 219 |
|
194 | 220 | // bad argument |
195 | | - Assert.ThrowsException<ArgumentOutOfRangeException>(() => |
| 221 | + _ = Assert.ThrowsException<ArgumentOutOfRangeException>(() => |
196 | 222 | q.ToTuple((CandlePart)999)); |
197 | 223 | } |
198 | 224 | } |
0 commit comments