public void Core_Configuration_ConfigurationManagerCore_ConnectionStrings() { var itemToTest = new ConnectionStringSafe(); var configuration = new ConfigurationManagerCore(ApplicationTypes.Native); // Validity itemToTest.Value = "Invalid Connection String!!!"; Assert.IsTrue(itemToTest.IsValid == false); // ADO itemToTest = configuration.ConnectionString("Example-SQLServer"); Assert.IsTrue(itemToTest.ToString("EF") != string.Empty); Assert.IsTrue(itemToTest.IsADO); Assert.IsTrue(itemToTest.IsEF == false); Assert.IsTrue(itemToTest.IsValid); Assert.IsTrue(itemToTest.ConnectionStringType == ConnectionStringSafe.ConnectionStringTypes.ADO); Assert.IsTrue(itemToTest.ToEF(this.GetType()) != string.Empty); // EF itemToTest = configuration.ConnectionString("Example-EDMX"); Assert.IsTrue(itemToTest.ToString("ADO") != string.Empty); Assert.IsTrue(itemToTest.IsEF); Assert.IsTrue(itemToTest.IsADO == false); Assert.IsTrue(itemToTest.IsValid); Assert.IsTrue(itemToTest.ConnectionStringType == ConnectionStringSafe.ConnectionStringTypes.EF); Assert.IsTrue(itemToTest.ToEF(this.GetType()) != string.Empty); // Specific config entries var connectionToTest = new ConnectionStringSafe(); connectionToTest = configuration.ConnectionString("Example-EDMX"); Assert.IsTrue(connectionToTest.Value != string.Empty); Assert.IsTrue(connectionToTest.IsEF); connectionToTest = configuration.ConnectionString("Example-SQLServer"); Assert.IsTrue(connectionToTest.Value != string.Empty); Assert.IsTrue(connectionToTest.IsADO); }
public void Core_Configuration_ConnectionStringSafe() { var itemToTest = new ConnectionStringSafe(); var configuration = new ConfigurationManagerCore(ApplicationTypes.Native); // ADO itemToTest = configuration.ConnectionString("Example-SQLServer"); Assert.IsTrue(itemToTest.Value != string.Empty); itemToTest.EDMXFileName = "TestEDMXFile"; Assert.IsTrue(itemToTest.ToString("EF") != string.Empty); Assert.IsTrue(itemToTest.ToEF(this.GetType()) != string.Empty); // EF itemToTest = configuration.ConnectionString("Example-EDMX"); Assert.IsTrue(itemToTest.Value != string.Empty); Assert.IsTrue(itemToTest.ToString("ADO") != string.Empty); Assert.IsTrue(itemToTest.ToADO() != string.Empty); }
public void Data_ConnectionStringDatabase() { var configManager = new ConfigurationManagerCore(ApplicationTypes.Native); var configConnectString = configManager.ConnectionString(this.GetAttributeValue <ConnectionStringName>(ConnectionStringName.DefaultConnectionName)); var result = configConnectString.ToEF(typeof(EntityWithConnectString)); Assert.IsTrue(result != Defaults.String); Assert.IsTrue(configConnectString.IsValid); Assert.IsTrue(configConnectString.IsEF || configConnectString.IsADO); Assert.IsTrue(configConnectString.ConnectionStringType != ConnectionStringSafe.ConnectionStringTypes.Empty && configConnectString.ConnectionStringType != ConnectionStringSafe.ConnectionStringTypes.Invalid); }