public async Task Handle_Valid_CSharpCodeAction_WithRazorResolver_ResolvesNull()
        {
            // Arrange
            var codeActionEndpoint = new CodeActionResolutionEndpoint(
                new RazorCodeActionResolver[] {
                new MockRazorCodeActionResolver("Test"),
            },
                Array.Empty <CSharpCodeActionResolver>(),
                LoggerFactory);
            var requestParams = new RazorCodeActionResolutionParams()
            {
                Action   = "Test",
                Language = LanguageServerConstants.CodeActions.Languages.CSharp,
                Data     = JObject.FromObject(new CSharpCodeActionParams())
            };
            var request = new CodeAction()
            {
                Title = "Valid request",
                Data  = JToken.FromObject(requestParams)
            };

#if DEBUG
            // Act & Assert (Throws due to debug asserts)
            await Assert.ThrowsAnyAsync <Exception>(async() => await codeActionEndpoint.Handle(request, default));
#else
            // Act
            var resolvedCodeAction = await codeActionEndpoint.Handle(request, default);

            // Assert
            Assert.Null(resolvedCodeAction.Edit);
#endif
        }
        public async Task Handle_Valid_RazorCodeAction_WithoutResolver()
        {
            // Arrange
            var codeActionEndpoint = new CodeActionResolutionEndpoint(
                Array.Empty <RazorCodeActionResolver>(),
                Array.Empty <CSharpCodeActionResolver>(),
                LoggerFactory);
            var requestParams = new RazorCodeActionResolutionParams()
            {
                Action   = "Test",
                Language = LanguageServerConstants.CodeActions.Languages.Razor,
                Data     = new AddUsingsCodeActionParams()
            };
            var request = new CodeAction()
            {
                Title = "Valid request",
                Data  = JToken.FromObject(requestParams)
            };

#if DEBUG
            // Act & Assert (Throws due to debug assert on no Razor.Test resolver)
            await Assert.ThrowsAnyAsync <Exception>(async() => await codeActionEndpoint.Handle(request, default));
#else
            // Act
            var resolvedCodeAction = await codeActionEndpoint.Handle(request, default);

            // Assert
            Assert.Null(resolvedCodeAction.Edit);
#endif
        }
        public async Task Handle_Valid_CSharpCodeAction_WithMultipleLanguageResolvers()
        {
            // Arrange
            var codeActionEndpoint = new CodeActionResolutionEndpoint(
                new RazorCodeActionResolver[] {
                new MockRazorCodeActionResolver("TestRazor"),
            },
                new CSharpCodeActionResolver[] {
                new MockCSharpCodeActionResolver("TestCSharp"),
            },
                LoggerFactory);
            var requestParams = new RazorCodeActionResolutionParams()
            {
                Action   = "TestCSharp",
                Language = LanguageServerConstants.CodeActions.Languages.CSharp,
                Data     = JObject.FromObject(new CSharpCodeActionParams())
            };
            var request = new CodeAction()
            {
                Title = "Valid request",
                Data  = JToken.FromObject(requestParams)
            };

            // Act
            var razorCodeAction = await codeActionEndpoint.Handle(request, default);

            // Assert
            Assert.NotNull(razorCodeAction.Edit);
        }
        public async Task Handle_ResolveEditBasedCodeActionCommand()
        {
            // Arrange
            var codeActionEndpoint = new CodeActionResolutionEndpoint(
                Array.Empty <RazorCodeActionResolver>(),
                new CSharpCodeActionResolver[] {
                new MockCSharpCodeActionResolver("Test"),
            },
                LoggerFactory);
            var requestParams = new RazorCodeActionResolutionParams()
            {
                Action   = LanguageServerConstants.CodeActions.EditBasedCodeActionCommand,
                Language = LanguageServerConstants.CodeActions.Languages.Razor,
                Data     = JToken.FromObject(new WorkspaceEdit())
            };

            var request = new CodeAction()
            {
                Title = "Valid request",
                Data  = JToken.FromObject(requestParams)
            };

            // Act
            var razorCodeAction = await codeActionEndpoint.Handle(request, default);

            // Assert
            Assert.NotNull(razorCodeAction.Edit);
        }
        public async Task Handle_Valid_RazorCodeAction_WithResolver()
        {
            // Arrange
            var codeActionEndpoint = new CodeActionResolutionEndpoint(
                new RazorCodeActionResolver[] {
                new MockRazorCodeActionResolver("Test"),
            },
                Array.Empty <CSharpCodeActionResolver>(),
                LoggerFactory);
            var requestParams = new RazorCodeActionResolutionParams()
            {
                Action   = "Test",
                Language = LanguageServerConstants.CodeActions.Languages.Razor,
                Data     = new AddUsingsCodeActionParams()
            };
            var request = new CodeAction()
            {
                Title = "Valid request",
                Data  = JToken.FromObject(requestParams)
            };

            // Act
            var razorCodeAction = await codeActionEndpoint.Handle(request, default);

            // Assert
            Assert.NotNull(razorCodeAction.Edit);
        }