public void Process_Command_Line_Arguments_Properly() { var indexMethod = new IndexMethod(); { var options = indexMethod.ExtractIndexOptions(new string[] { }); options.AccessBreakpoints.Should().BeNull(); options.End.Should().BeNull(); options.BreakpointMasks.Should().BeNull(); options.IsAllPositionsInRange.Should().BeFalse(); options.Step.Should().Be(0); options.Start.Should().BeNull(); options.MemoryRanges.Should().BeNull(); } { var options = indexMethod.ExtractIndexOptions(new[] { "-s", "0:0", "-m", "abc123L50", "def341:def441", "-e", "1:0", "--step", "1", "--ba", "rw8:abc120", "--bm", "kernel32!*", "-a" }); options.AccessBreakpoints.Should().HaveCount(1); options.End.Should().Be(new Position(1, 0)); options.BreakpointMasks.Should().HaveCount(1); options.IsAllPositionsInRange.Should().BeTrue(); options.Step.Should().Be(1); options.Start.Should().Be(new Position(0, 0)); options.MemoryRanges.Should().HaveCount(2); } }
public void Properly_Parse_Args_Into_Options() { // arrange var args0 = "--start abc:123 --end def:456 --bm kernel32!*create* user32!* --ba rw8:10000 w4:30000 -m abcl100 abc:def" .Split(' '); var options0 = new IndexOptions { Start = new Position(0xabc, 0x123), End = new Position(0xdef, 0x456), BreakpointMasks = new[] { new BreakpointMask("kernel32", "*create*"), new BreakpointMask("user32", "*") }, AccessBreakpoints = new[] { new AccessBreakpoint(0x10000, 8, true, true), new AccessBreakpoint(0x30000, 4, false, true) }, MemoryRanges = new[] { new MemoryRange(0xabc, 0xbbc), new MemoryRange(0xabc, 0xdef) } }; var index = new IndexMethod(); // act // assert index.ExtractIndexOptions(args0).Should().Be(options0); }