Exemple #1
0
        public async Task AddRemoveBreakpoint()
        {
            const string code =
                @"x <- 1
  y <- 2
  z <- 3";

            var tracer = await _session.TraceExecutionAsync();

            using (var sf = new SourceFile(code)) {
                var bp1Loc = new RSourceLocation(sf.FilePath, 1);
                var bp1    = await tracer.CreateBreakpointAsync(bp1Loc);

                bp1.Location.Should().Be(bp1Loc);
                bp1.Tracer.Should().Be(tracer);

                tracer.Breakpoints.Count.Should().Be(1);

                var bp2Loc = new RSourceLocation(sf.FilePath, 3);
                var bp2    = await tracer.CreateBreakpointAsync(bp2Loc);

                bp2.Location.Should().Be(bp2Loc);
                bp2.Tracer.Should().Be(tracer);

                tracer.Breakpoints.Count.Should().Be(2);

                await bp1.DeleteAsync();

                tracer.Breakpoints.Count.Should().Be(1);
                tracer.Breakpoints.First().Should().BeSameAs(bp2);
            }
        }