Пример #1
0
        public void ThrowExceptionIfSelectIsNull()
        {
            var sut = new SqlQueryGenerator(null, null, null, null);
            var argumentException = Assert.Throws <ArgumentException>(() => sut.ToString());

            Assert.Equal("Query Must Have a Select Part", argumentException.Message);
        }
Пример #2
0
        public void BuildCorrectQuery(string expectedSql, string @select, string @where, string @groupBy, string orderBy)
        {
            var fakeSelect  = GetFakeSelect(@select);
            var fakeWhere   = GetFakeWhere(@where);
            var fakeGroupBy = GetFakeGroupBy(@groupBy);
            var fakeOrderBy = GetFakeOrderBy(orderBy);

            var sut = new SqlQueryGenerator(fakeSelect?.Object, fakeWhere?.Object, fakeGroupBy?.Object, fakeOrderBy?.Object);

            Assert.Equal(expectedSql, sut.ToString());
        }