public async Task ViewsAreServedWithoutInstrumentationByDefault(
            string actionName,
            string expected,
            IEnumerable<Tuple<int, int, bool>> expectedLineMappings)
        {
            // Arrange
            var context = new TestPageExecutionContext();
            var server = TestHelper.CreateServer(_app, SiteName, services =>
            {
                services.AddInstance(context);
                _configureServices(services);
            });
            var client = server.CreateClient();

            // Act
            var body = await client.GetStringAsync("http://localhost/Home/" + actionName);

            // Assert
            Assert.Equal(expected, body.Trim());
            Assert.Empty(context.Values);
        }
        public async Task ViewsCanSwitchFromRegularToInstrumented(
            string actionName,
            string expected,
            IEnumerable<Tuple<int, int, bool>> expectedLineMappings)
        {
            // Arrange - 1
            var context = new TestPageExecutionContext();
            var server = TestHelper.CreateServer(_app, SiteName, services =>
            {
                services.AddInstance(context);
                _configureServices(services);
            });
            var client = server.CreateClient();

            // Act - 1
            var body = await client.GetStringAsync("http://localhost/Home/" + actionName);

            // Assert - 1
            Assert.Equal(expected, body.Trim());
            Assert.Empty(context.Values);

            // Arrange - 2
            client.DefaultRequestHeaders.Add("ENABLE-RAZOR-INSTRUMENTATION", "true");

            // Act - 2
            body = await client.GetStringAsync("http://localhost/Home/" + actionName);

            // Assert - 2
            Assert.Equal(expected, body.Trim());
            Assert.Equal(expectedLineMappings, context.Values);
        }
        public async Task SwitchingFromNonInstrumentedToInstrumentedWorksForLayoutAndViewStarts()
        {
            // Arrange - 1
            var expectedLineMappings = new[]
            {
                Tuple.Create(93, 2, true),
                Tuple.Create(96, 16, false),
                Tuple.Create(112, 2, true),
                Tuple.Create(0, 2, true),
                Tuple.Create(2, 8, true),
                Tuple.Create(10, 16, false),
                Tuple.Create(26, 1, true),
                Tuple.Create(27, 21, true),
                Tuple.Create(0, 7, true),
                Tuple.Create(8, 12, false),
                Tuple.Create(20, 2, true),
                Tuple.Create(23, 12, false),
                Tuple.Create(35, 8, true),
            };
            var context = new TestPageExecutionContext();
            var server = TestHelper.CreateServer(_app, SiteName, services =>
            {
                services.AddInstance(context);
                _configureServices(services);
            });
            var client = server.CreateClient();

            // Act - 1
            var body = await client.GetStringAsync("http://localhost/Home/FullPath");

            // Assert - 1
            Assert.Empty(context.Values);

            // Arrange - 2
            client.DefaultRequestHeaders.Add("ENABLE-RAZOR-INSTRUMENTATION", "true");

            // Act - 2
            body = await client.GetStringAsync("http://localhost/Home/ViewDiscoveryPath");

            // Assert - 2
            Assert.Equal(expectedLineMappings, context.Values);
        }
        public async Task ViewsAreInstrumentedWhenPageExecutionListenerFeatureIsEnabled(
            string actionName,
            string expected,
            IEnumerable<Tuple<int, int, bool>> expectedLineMappings)
        {
            // Arrange
            var context = new TestPageExecutionContext();
            var server = TestHelper.CreateServer(_app, SiteName, services =>
            {
                services.AddInstance(context);
                _configureServices(services);
            });
            var client = server.CreateClient();
            client.DefaultRequestHeaders.Add("ENABLE-RAZOR-INSTRUMENTATION", "true");

            // Act
            var body = await client.GetStringAsync("http://localhost/Home/" + actionName);

            // Assert
            Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
            Assert.Equal(expectedLineMappings, context.Values);
        }