public void Configuration_ConfigurationManagerSafe_ConnectionStrings() { var itemToTest = new ConnectionStringSafe(); var configuration = ConfigurationManagerSafeTests.ConfigurationManagerSafeConstruct(); // Validity itemToTest.Value = "Invalid Connection String!!!"; Assert.IsTrue(itemToTest.IsValid == false); // ADO itemToTest = configuration.ConnectionString("TestADOConnection"); Assert.IsTrue(itemToTest.ToString("EF") != TypeExtension.DefaultString); Assert.IsTrue(itemToTest.IsADO == true); Assert.IsTrue(itemToTest.IsEF == false); Assert.IsTrue(itemToTest.IsValid == true); Assert.IsTrue(itemToTest.ConnectionStringType == ConnectionStringSafe.ConnectionStringTypes.ADO); Assert.IsTrue(itemToTest.ToEF(this.GetType()) != TypeExtension.DefaultString); // EF itemToTest = configuration.ConnectionString("TestEFConnection"); Assert.IsTrue(itemToTest.ToString("ADO") != TypeExtension.DefaultString); Assert.IsTrue(itemToTest.IsEF == true); Assert.IsTrue(itemToTest.IsADO == false); Assert.IsTrue(itemToTest.IsValid == true); Assert.IsTrue(itemToTest.ConnectionStringType == ConnectionStringSafe.ConnectionStringTypes.EF); Assert.IsTrue(itemToTest.ToEF(this.GetType()) != TypeExtension.DefaultString); }
public void Configuration_ConfigurationManagerSafe_AppSettings() { var itemToTest = new AppSettingSafe(); var configuration = ConfigurationManagerSafeTests.ConfigurationManagerSafeConstruct(); itemToTest = configuration.AppSetting("TestAppSetting"); Assert.IsTrue(itemToTest.Value != TypeExtension.DefaultString); }
public void Configuration_ConnectionStringSafe() { var itemToTest = new ConnectionStringSafe(); var configuration = ConfigurationManagerSafeTests.ConfigurationManagerSafeConstruct(); // ADO itemToTest = configuration.ConnectionString("TestADOConnection"); Assert.IsTrue(itemToTest.Value != TypeExtension.DefaultString); itemToTest.EDMXFileName = "TestEDMXFile"; Assert.IsTrue(itemToTest.ToString("EF") != TypeExtension.DefaultString); Assert.IsTrue(itemToTest.ToEF(this.GetType()) != TypeExtension.DefaultString); // EF itemToTest = configuration.ConnectionString("TestEFConnection"); Assert.IsTrue(itemToTest.Value != TypeExtension.DefaultString); Assert.IsTrue(itemToTest.ToString("ADO") != TypeExtension.DefaultString); Assert.IsTrue(itemToTest.ToADO() != TypeExtension.DefaultString); }
public async Task Net_HttpRequestDelete_SendAsync() { object dataOut = null; var configuration = ConfigurationManagerSafeTests.ConfigurationManagerSafeConstruct(); var request = new HttpRequestDelete <object>(configuration.AppSettingValue(AppSettingList.MyWebServiceKeyName) + "/HomeApi"); try { dataOut = await request.SendAsync(); Assert.IsTrue(request.Response.IsSuccessStatusCode); } catch (WebException) { Assert.IsTrue(dataOut != null); } finally { request.Dispose(); } }
public async Task Net_HttpRequestPutString_SendAsync() { var dataOut = TypeExtension.DefaultString; var configuration = ConfigurationManagerSafeTests.ConfigurationManagerSafeConstruct(); var request = new HttpRequestPutString(configuration.AppSettingValue("MyWebService") + "/HomeApi"); try { dataOut = await request.SendAsync(); Assert.IsTrue(request.Response.IsSuccessStatusCode); throw new WebException(); } catch (WebException) { Assert.IsTrue(dataOut != null); } finally { request.Dispose(); } }
/// <summary> /// Constructs a current instance of .config AppSettings and ConnectionStrings nodes /// Universal/Core does not support ConfigurationManager, so have to construct using Universal friendly means /// </summary> /// <returns></returns> public static ConfigurationManagerSafe ConfigurationManagerSafeConstruct() { return(new ConfigurationManagerSafe(ConfigurationManagerSafeTests.AppSettingsGet(), ConfigurationManagerSafeTests.ConnectionStringsGet())); }