public void MultipleProcessorTest() { // given: glitcher configuration with multiple processors byte[] bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; GlitcherConfiguration config = new GlitcherConfiguration(); BitShiftProcessor bitShiftProcessor = new BitShiftProcessor(new EveryNthByteIndexProvider(new ByteRange(0, 5), 1), new FixedByteProvider(1), ShiftDirection.Left); MathProcessor mathProcessor = new MathProcessor(new EveryNthByteIndexProvider(new ByteRange(0, (uint)bytes.Length), 1), new FixedByteProvider(1), Operation.Add, false); config.ProcessorChain.Add(bitShiftProcessor); config.ProcessorChain.Add(mathProcessor); // when: glitching byte[] actual = Glitcher.GlitchBytes(bytes, config); // then: bytes are correct byte[] expected = new byte[] { 1, 3, 5, 7, 9, 6, 7, 8, 9, 10 }; CollectionAssert.AreEqual(expected, actual); }
public void EmptyBytesToGlitchTest() { // when: trying to glitch without a GlitcherConfiguration // then: ArgumentNullException Assert.That(() => Glitcher.GlitchBytes(new byte[0], new GlitcherConfiguration()), Throws.ArgumentException); }
public void NoGlitcherConfigurationTest() { // when: trying to glitch without a GlitcherConfiguration // then: ArgumentNullException Assert.That(() => Glitcher.GlitchBytes(new byte[] { 0, 1, 2, 3, 4 }, null), Throws.ArgumentNullException); }