Esempio n. 1
0
        public void CanEnumerateByTypeMemoryBreakpoints()
        {
            var breakpoint1 = new MemoryChangedBreakpoint(0x1234, 1);
            var breakpoint2 = new MemoryValueEqualsBreakpoint(0x2345, 1, 0x55);
            var breakpoint3 = new MemoryChangedBreakpoint(0x0123, 10);

            MemoryDebugger.AddBreakpoint(breakpoint1);
            MemoryDebugger.AddBreakpoint(breakpoint2);
            MemoryDebugger.AddBreakpoint(breakpoint3);

            int count = 0;

            var enumerator = ((IEnumerable)(MemoryDebugger.Breakpoints)).GetEnumerator();

            while (true)
            {
                if (!enumerator.MoveNext())
                {
                    break;
                }
                Assert.IsTrue(enumerator.Current is MemoryBreakpoint);
                count++;
            }

            Assert.AreEqual(3, count);
        }
Esempio n. 2
0
        public void MemoryBreakpointsIndexOfFindsBreakpoints()
        {
            var breakpoint1 = new MemoryChangedBreakpoint(0x1234, 1);
            var breakpoint2 = new MemoryValueEqualsBreakpoint(0x2345, 1, 0x55);
            var breakpoint3 = new MemoryChangedBreakpoint(0x0123, 10);

            MemoryDebugger.AddBreakpoint(breakpoint1);
            MemoryDebugger.AddBreakpoint(breakpoint2);

            Assert.AreEqual(0, MemoryDebugger.Breakpoints.IndexOf(breakpoint1));
            Assert.AreEqual(1, MemoryDebugger.Breakpoints.IndexOf(breakpoint2));
            Assert.AreEqual(-1, MemoryDebugger.Breakpoints.IndexOf(breakpoint3));
        }
Esempio n. 3
0
        public void CanDeleteMemoryBreakpoint()
        {
            var breakpoint1 = new MemoryChangedBreakpoint(0x1234, 1);
            var breakpoint2 = new MemoryValueEqualsBreakpoint(0x2345, 1, 0x55);
            var breakpoint3 = new MemoryChangedBreakpoint(0x0123, 10);

            MemoryDebugger.AddBreakpoint(breakpoint1);
            MemoryDebugger.AddBreakpoint(breakpoint2);
            MemoryDebugger.AddBreakpoint(breakpoint3);

            MemoryDebugger.DeleteBreakpoint(breakpoint2);

            Assert.AreEqual(2, MemoryDebugger.Breakpoints.Count);
            Assert.IsTrue(MemoryDebugger.Breakpoints[0] is MemoryChangedBreakpoint);
            Assert.IsTrue(MemoryDebugger.Breakpoints[1] is MemoryChangedBreakpoint);
        }
Esempio n. 4
0
        public void CanForEachMemoryBreakpoints()
        {
            var breakpoint1 = new MemoryChangedBreakpoint(0x1234, 1);
            var breakpoint2 = new MemoryValueEqualsBreakpoint(0x2345, 1, 0x55);
            var breakpoint3 = new MemoryChangedBreakpoint(0x0123, 10);

            MemoryDebugger.AddBreakpoint(breakpoint1);
            MemoryDebugger.AddBreakpoint(breakpoint2);
            MemoryDebugger.AddBreakpoint(breakpoint3);

            int count = 0;

            foreach (var breakpoint in MemoryDebugger.Breakpoints)
            {
                Assert.IsTrue(breakpoint is MemoryBreakpoint);
                count++;
            }

            Assert.AreEqual(3, count);
        }
Esempio n. 5
0
        public void CantInsertMemoryBreakpoint()
        {
            var breakpoint1 = new MemoryChangedBreakpoint(0x1234, 1);
            var breakpoint2 = new MemoryValueEqualsBreakpoint(0x2345, 1, 0x55);
            var breakpoint3 = new MemoryChangedBreakpoint(0x0123, 10);

            MemoryDebugger.AddBreakpoint(breakpoint1);
            MemoryDebugger.AddBreakpoint(breakpoint2);

            try
            {
                MemoryDebugger.Breakpoints.Insert(1, breakpoint3);
            }
            catch (NotImplementedException)
            {
                Assert.Pass();
            }

            Assert.Fail();
        }