Distinct() 공개 메소드

public Distinct ( ) : IFunctionOrFrom
리턴 IFunctionOrFrom
        public void SelectDistinctColumnWithSqlCharacters()
        {
            var sqlBuilder = new SelectSqlBuilder(MsSqlCharacters.Instance, (string)null);

            var sqlQuery = sqlBuilder
                .Distinct("CreditLimit")
                .From(typeof(Customer))
                .ToSqlQuery();

            Assert.Equal("SELECT DISTINCT [CreditLimit] FROM [Sales].[Customers]", sqlQuery.CommandText);
            Assert.Equal(0, sqlQuery.Arguments.Count);
        }
        public void DistinctThrowsArgumentExceptionForNullColumns()
        {
            var sqlBuilder = new SelectSqlBuilder(SqlCharacters.Empty);

            var exception = Assert.Throws<ArgumentNullException>(
                () => sqlBuilder.Distinct((string[])null));

            Assert.Equal("columns", exception.ParamName);
        }
        public void SelectDistinctColumn()
        {
            var sqlBuilder = new SelectSqlBuilder(SqlCharacters.Empty, (string)null);

            var sqlQuery = sqlBuilder
                .Distinct("CreditLimit")
                .From(typeof(Customer))
                .ToSqlQuery();

            Assert.Equal("SELECT DISTINCT CreditLimit FROM Sales.Customers", sqlQuery.CommandText);
            Assert.Equal(0, sqlQuery.Arguments.Count);
        }
        public void DistinctThrowsArgumentExceptionForNullColumnName()
        {
            var sqlBuilder = new SelectSqlBuilder(SqlCharacters.Empty);

            var exception = Assert.Throws<ArgumentException>(
                () => sqlBuilder.Distinct((string)null));

            Assert.Equal(ExceptionMessages.ArgumentNullOrEmpty.FormatWith("column"), exception.Message);
        }