public void WithoutMaxBytesTest() { // given: range and byte rule ByteRange range = new ByteRange(0, 11); EveryNthByteIndexProvider rule = new EveryNthByteIndexProvider(range, 2); rule.CreatePossibleByteIndexes(); List <uint> expectedIndexes = new List <uint>() { 1, 3, 5, 7, 9, 11 }; // when: getting the bytes List <uint> actualIndexes = new List <uint>(); while (rule.ByteIndexPool.Count != 0) { actualIndexes.Add(rule.GetNextByteIndex()); } // then: indexes match CollectionAssert.AreEqual(expectedIndexes, actualIndexes); }
public void SubtractWrapAroundTest() { // given MathProcessor byte[] bytes = new byte[] { 5, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; EveryNthByteIndexProvider byteRule = new EveryNthByteIndexProvider(new ByteRange(0, (uint)bytes.Length), 1); MathProcessor proc = new MathProcessor(byteRule, new FixedByteProvider(10), Operation.Subtract, true); // when: applying the processor var actual = proc.Apply(bytes); // then: correctly modified byte[] expected = new byte[] { 251, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; CollectionAssert.AreEqual(expected, actual); }
public EveryNthByteIndexProviderViewModel(EveryNthByteIndexProvider provider) { }