public void ApplyParametersComplexTest() { try { NHibernateSqlOutputFormatter nhibernateFormatter = new NHibernateSqlOutputFormatter(); sqlStatement = nhibernateFormatter.TryParsSql(SecureResources.SQL14); Assert.IsTrue(sqlStatement.Parameters.Count == 1); string appliedParameterSql = sqlStatement.ApplyParameters(); Assert.IsFalse(appliedParameterSql.Contains("@")); string appliedFormatSql = sqlStatement.ApplySuggestedFormat(); Assert.IsTrue(appliedFormatSql.Length == 3454); sqlStatement = nhibernateFormatter.TryParsSql(Properties.SecureResources.SQL7); appliedFormatSql = sqlStatement.ApplySuggestedFormat(); Assert.IsFalse(appliedParameterSql.Contains("@")); sqlStatement = nhibernateFormatter.TryParsSql(Properties.SecureResources.SQL8); appliedFormatSql = sqlStatement.ApplySuggestedFormat(); Assert.IsFalse(appliedParameterSql.Contains("@")); } catch (Exception exception) { Assert.IsNotInstanceOfType(exception, typeof(Exception)); } finally { SecureResources.ResourceManager.ReleaseAllResources(); } }
public void ParseTest() { NHibernateSqlOutputFormatter nhibernateFormatter = new NHibernateSqlOutputFormatter(); sqlStatement = nhibernateFormatter.TryParsSql(SecureResources.SQLInsert1); Assert.IsTrue(sqlStatement.Parameters.Count == 4); string appliedParameterSql = sqlStatement.ApplyParameters(); Assert.IsFalse(appliedParameterSql.Contains("@")); string appliedFormatSql = sqlStatement.ApplySuggestedFormat(); Assert.IsTrue(appliedFormatSql.Length == 161); }
public void ApplyParametersSqlColesceSelectTest() { try { NHibernateSqlOutputFormatter nhibernateFormatter = new NHibernateSqlOutputFormatter(); nhibernateFormatter.SqlIdentifiers = new string[] { "NHibernate.SQL:" }; sqlStatement = nhibernateFormatter.TryParsSql(SecureResources.ColesceSelectSql); Assert.IsTrue(sqlStatement.Parameters.Count == 3); string appliedParameterSql = sqlStatement.ApplyParameters(); Assert.IsFalse(appliedParameterSql.Contains("@")); string appliedFormatSql = sqlStatement.ApplySuggestedFormat(); Assert.IsTrue(appliedFormatSql.Length == 371); } catch (Exception exception) { Assert.IsNotInstanceOfType(exception, typeof(Exception)); } finally { SecureResources.ResourceManager.ReleaseAllResources(); } }
public void ApplySuggestedFormatNoColumnTableNameAliasTest() { try { NHibernateSqlOutputFormatter nhibernateFormatter = new NHibernateSqlOutputFormatter(); nhibernateFormatter.SqlIdentifiers = new string[] { Environment.NewLine }; sqlStatement = nhibernateFormatter.TryParsSql(SecureResources.NoColumnOrTableNameAliases); Assert.IsTrue(sqlStatement.Parameters.Count == 1); string appliedParameterSql = sqlStatement.ApplyParameters(); Assert.IsFalse(appliedParameterSql.Contains("@")); string appliedFormatSql = sqlStatement.ApplySuggestedFormat(); Assert.IsTrue(appliedFormatSql.Length == 195); } catch { throw; } finally { SecureResources.ResourceManager.ReleaseAllResources(); } }
public void ApplySuggestedFormatAliasQuotedValuesTest() { try { NHibernateSqlOutputFormatter nhibernateFormatter = new NHibernateSqlOutputFormatter(); nhibernateFormatter.SqlIdentifiers = new string[] { Environment.NewLine }; sqlStatement = nhibernateFormatter.TryParsSql(SecureResources.ColumnNameAliasQuotedValues); Assert.IsTrue(sqlStatement.Parameters.Count == 2); string appliedParameterSql = sqlStatement.ApplyParameters(); Assert.IsFalse(appliedParameterSql.Contains("@")); string appliedFormatSql = sqlStatement.ApplySuggestedFormat(); Assert.IsTrue(appliedFormatSql.Length == 1375); } catch (Exception exception) { Assert.IsNotInstanceOfType(exception, typeof(Exception)); } finally { SecureResources.ResourceManager.ReleaseAllResources(); } }