Habanero.DB.SqlFormatterForSqlServerCe.GetLimitClauseCriteriaForBegin C# (CSharp) Метод

GetLimitClauseCriteriaForBegin() публичный Метод

Returns the beginning limit clause with the limit specified
public GetLimitClauseCriteriaForBegin ( int limit ) : string
limit int The limit
Результат string
	    public override string GetLimitClauseCriteriaForBegin(int limit)
		{
			return string.IsNullOrEmpty(LimitClauseAtBeginning) ? "" : string.Format("{0}({1})", LimitClauseAtBeginning, limit);
		}
	}

Usage Example

		public void GetLimitClauseCriteriaForBegin_ShouldFormatTopWithBrackets()
		{
			//---------------Set up test pack-------------------
			var sqlFormatter = new SqlFormatterForSqlServerCe("[", "]", "TOP", "");
			int limit = TestUtil.GetRandomInt();
			//---------------Assert Precondition----------------
			Assert.AreEqual("TOP", sqlFormatter.LimitClauseAtBeginning);
			//---------------Execute Test ----------------------
			string limitClauseCriteriaForBegin = sqlFormatter.GetLimitClauseCriteriaForBegin(limit);
			//---------------Test Result -----------------------
			string expected = string.Format("TOP({0})", limit);
			Assert.AreEqual(expected,limitClauseCriteriaForBegin);
		}