Skip to main content
Glama

powerbi-tabular-mcp

CommandLineTests.cs2.64 kB
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using pbi_local_mcp.Resources; namespace pbi_local_mcp.Tests; /// <summary> /// Unit tests for command-line argument processing functionality /// </summary> public class CommandLineTests { private readonly ILogger<ServerConfigurator> _logger; public CommandLineTests() { _logger = new NullLogger<ServerConfigurator>(); } [Fact] public void ProcessCommandLineArguments_WithValidPort_SetsEnvironmentVariables() { // Arrange var serverConfigurator = new ServerConfigurator(_logger); var args = new[] { "--port", "12345" }; // Clear any existing environment variables Environment.SetEnvironmentVariable("PBI_PORT", null); Environment.SetEnvironmentVariable("PBI_DB_ID", null); // Note: This test would require mocking the database discovery // For now, we'll just test the argument parsing structure // Act & Assert // The actual test would need to mock the database discovery // This is a placeholder to show the test structure Assert.True(true); // Placeholder assertion } [Fact] public void ProcessCommandLineArguments_WithInvalidPort_ThrowsArgumentException() { // Arrange var serverConfigurator = new ServerConfigurator(_logger); var args = new[] { "--port", "invalid" }; // Act & Assert // This would test that invalid ports throw exceptions // Implementation would require refactoring to make the method testable Assert.True(true); // Placeholder assertion } [Fact] public void ProcessCommandLineArguments_WithPortOutOfRange_ThrowsArgumentException() { // Arrange var serverConfigurator = new ServerConfigurator(_logger); var args = new[] { "--port", "70000" }; // Port above valid range // Act & Assert // This would test port range validation Assert.True(true); // Placeholder assertion } [Fact] public void ProcessCommandLineArguments_WithNoPort_DoesNotSetEnvironmentVariables() { // Arrange var serverConfigurator = new ServerConfigurator(_logger); var args = Array.Empty<string>(); // Clear any existing environment variables Environment.SetEnvironmentVariable("PBI_PORT", null); Environment.SetEnvironmentVariable("PBI_DB_ID", null); // Act & Assert // This would test that no arguments don't set environment variables Assert.True(true); // Placeholder assertion } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jonaolden/tabular-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server