public void ThrowExceptionOnSqlStatementBuilderCreateDeleteIfTheTableIsEmpty() { // Setup var statementBuilder = new SqlStatementBuilder(); var queryBuilder = new QueryBuilder(); var tableName = ""; // Act statementBuilder.CreateDelete(queryBuilder: queryBuilder, tableName: tableName); }
public void TestWithoutMappings() { // Setup var statementBuilder = new SqlStatementBuilder(); var queryBuilder = new QueryBuilder <TestWithoutMappingsClass>(); // Act var actual = statementBuilder.CreateDelete(queryBuilder, null); var expected = $"" + $"DELETE " + $"FROM [TestWithoutMappingsClass] ;"; // Assert Assert.AreEqual(expected, actual); }
public void TestSqlStatementBuilderCreateDelete() { // Setup var statementBuilder = new SqlStatementBuilder(); var queryBuilder = new QueryBuilder(); var tableName = "Table"; // Act var actual = statementBuilder.CreateDelete(queryBuilder: queryBuilder, tableName: tableName, where : null); var expected = "DELETE FROM [Table] ;"; // Assert Assert.AreEqual(expected, actual); }
public void TestWithMappings() { // Setup var statementBuilder = new SqlStatementBuilder(); var queryBuilder = new QueryBuilder <TestWithMappingsClass>(); var expression = new { Field1 = 1 }; // Act var queryGroup = QueryGroup.Parse(expression); var actual = statementBuilder.CreateDelete(queryBuilder, queryGroup); var expected = $"" + $"DELETE " + $"FROM [ClassName] " + $"WHERE ([Field1] = @Field1) ;"; // Assert Assert.AreEqual(expected, actual); }