public void TryGetModuleReference_ValidAlias_ReplacesReferenceValue(string aliasName, string referenceValue, string fullyQualifiedReferenceValue, RootConfiguration configuration)
        {
            var reference = TemplateSpecModuleReference.TryParse(aliasName, referenceValue, configuration, out var errorBuilder);

            reference.Should().NotBeNull();
            reference !.FullyQualifiedReference.Should().Be(fullyQualifiedReferenceValue);
        }
        public void TryParse_InvalidReference_ReturnsNullAndSetsFailureBuilder(string rawValue)
        {
            var parsed = TemplateSpecModuleReference.TryParse(null, rawValue, BicepTestConstants.BuiltInConfigurationWithAnalyzersDisabled, out var failureBuilder);

            parsed.Should().BeNull();
            ((object?)failureBuilder).Should().NotBeNull();
        }
        public void TryParse_InvalidAliasName_ReturnsNullAndSetsErrorDiagnostic(string aliasName)
        {
            var reference = TemplateSpecModuleReference.TryParse(aliasName, "", BicepTestConstants.BuiltInConfiguration, out var errorBuilder);

            reference.Should().BeNull();
            errorBuilder !.Should().HaveCode("BCP211");
            errorBuilder !.Should().HaveMessage($"The module alias name \"{aliasName}\" is invalid. Valid characters are alphanumeric, \"_\", or \"-\".");
        }
        public void TryParse_InvalidAlias_ReturnsNullAndSetsError(string aliasName, string referenceValue, RootConfiguration configuration, string expectedCode, string expectedMessage)
        {
            var reference = TemplateSpecModuleReference.TryParse(aliasName, referenceValue, configuration, out var errorBuilder);

            reference.Should().BeNull();
            ((object?)errorBuilder).Should().NotBeNull();
            errorBuilder !.Should().HaveCode(expectedCode);
            errorBuilder !.Should().HaveMessage(expectedMessage);
        }
        public void TryParse_AliasNotInConfiguration_ReturnsNullAndSetsError(string aliasName, string referenceValue, string?configurationPath, string expectedCode, string expectedMessage)
        {
            var configuration = BicepTestConstants.CreateMockConfiguration(configurationPath: configurationPath);

            var reference = TemplateSpecModuleReference.TryParse(aliasName, referenceValue, configuration, out var errorBuilder);

            reference.Should().BeNull();
            ((object?)errorBuilder).Should().NotBeNull();
            errorBuilder !.Should().HaveCode(expectedCode);
            errorBuilder !.Should().HaveMessage(expectedMessage);
        }