public void ConfigureOracleTnsAdminPath_InvalidPaths_ShouldReturnEmptyPath()
 {
     DbProviderExtensions.ConfigureOracleTnsAdminPath(Path.Combine("oracle", "product")).Should().BeNullOrEmpty();
     DbProviderExtensions.ConfigureOracleTnsAdminPath(Path.Combine("network", "admin")).Should().BeNullOrEmpty();
     DbProviderExtensions.ConfigureOracleTnsAdminPath(Path.Combine("main1", "level1", "level2")).Should().BeNullOrEmpty();
     DbProviderExtensions.ConfigureOracleTnsAdminPath(Path.Combine("main2", "level1", "level2")).Should().BeNullOrEmpty();
 }
        public void ConfigureOracleTnsAdminPath_ValidPaths_ShouldReturnResolvedPath()
        {
            var str = Path.Combine("oracle", "product", "client", "network", "admin");

            DbProviderExtensions.ConfigureOracleTnsAdminPath(Path.Combine("oracle", "product", "client", "bin")).Should().EndWithEquivalent(str);
            DbProviderExtensions.ConfigureOracleTnsAdminPath(str).Should().EndWithEquivalent(str);
        }
        public void ConfigureOracleTnsAdminPath_EnvironmentResolvedOnAhoPC_ShouldReturnEmptyPath()
        {
            if (!Environment.MachineName.ContainsIgnoreCase("aho-p1"))
            {
                return;
            }

            DbProviderExtensions.ConfigureOracleTnsAdminPath(null).Should().BeEquivalentTo("C:\\Oracle\\product\\12.1.0\\client_1\\network\\admin");
        }
예제 #4
0
 public static IConfigurationBuilder AddDbToolsExampleConfiguration(this IConfigurationBuilder configurationBuilder,
                                                                    SupportedDatabaseTypes databaseType)
 {
     DbProviderExtensions.ConfigureOracleTnsAdminPath(Path.Combine("oracle", "product", "client", "bin"));
     return(configurationBuilder
            .AddJsonFile(BaseConfig.ConfigFilename(databaseType))
            .AddJsonFileIfTrue(BaseConfig.ConfigDockerFilename(databaseType), () => BaseConfig.InContainer)
            .AddInMemoryIfTrue(BaseConfig.ExternalServiceHostConfiguration, () => BaseConfig.UseExternalServiceHost));
 }
        public void ConfigureOracleTnsAdminPath_EnvironmentResolved_ShouldReturnEmptyPath()
        {
            var environmentPath1 = Path.Combine("main1", "level1", "level2") +
                                   $"{Path.PathSeparator}{Path.Combine("network", "admin")}" +
                                   $"{Path.PathSeparator}{Path.Combine("oracle", "product", "client", "bin", "no")}" +
                                   $"{Path.PathSeparator}{Path.Combine("main2", "level1", "level2")}";

            DbProviderExtensions.ConfigureOracleTnsAdminPath(string.Empty, environmentPath1).Should().BeNullOrEmpty();

            var environmentPath2 = Path.Combine("main1", "level1", "level2") +
                                   $"{Path.PathSeparator}{Path.Combine("network", "admin")}" +
                                   $"{Path.PathSeparator}{Path.Combine("oracle", "product", "client", "network")}" +
                                   $"{Path.PathSeparator}{Path.Combine("main2", "level1", "level2")}";

            DbProviderExtensions.ConfigureOracleTnsAdminPath(string.Empty, environmentPath2).Should().BeNullOrEmpty();
        }
        public void ConfigureOracleTnsAdminPath_EnvironmentResolved_ShouldReturnResolvedPath()
        {
            var expected = Path.Combine("oracle", "product", "client", "network", "admin");

            var environmentPath1 = Path.Combine("main1", "level1", "level2") +
                                   $"{Path.PathSeparator}{Path.Combine("network", "admin")}" +
                                   $"{Path.PathSeparator}{Path.Combine("oracle", "product", "client", "bin")}" +
                                   $"{Path.PathSeparator}{Path.Combine("main2", "level1", "level2")}";

            DbProviderExtensions.ConfigureOracleTnsAdminPath(string.Empty, environmentPath1).Should().EndWithEquivalent(expected);

            var environmentPath2 = Path.Combine("main1", "level1", "level2") +
                                   $"{Path.PathSeparator}{Path.Combine("network", "admin")}" +
                                   $"{Path.PathSeparator}{expected}" +
                                   $"{Path.PathSeparator}{Path.Combine("main2", "level1", "level2")}";

            DbProviderExtensions.ConfigureOracleTnsAdminPath(string.Empty, environmentPath2).Should().EndWithEquivalent(expected);
        }