public void AllParams_ReturnsProperlyQuoted() { TestDialect dialect = GetDialect(); string result = dialect.GetColumnName("bar", "foo", "al"); Assert.AreEqual("\"bar\".\"foo\" AS \"al\"", result); }
public void ContainsQuotes_DoesNotAddExtraQuotes() { TestDialect dialect = GetDialect(); string result = dialect.GetColumnName("\"bar\"", "\"foo\"", "\"al\""); Assert.AreEqual("\"bar\".\"foo\" AS \"al\"", result); }
public void PrefixColumnName_ReturnsProperlyQuoted() { TestDialect dialect = GetDialect(); string result = dialect.GetColumnName("bar", "foo", null); Assert.AreEqual("\"bar\".\"foo\"", result); }
public void TableNameOnly_ReturnsProperlyQuoted() { TestDialect dialect = GetDialect(); string result = dialect.GetTableName(null, "foo", null); Assert.AreEqual("\"foo\"", result); }
public void SchemaAndTable_ReturnsProperlyQuoted() { TestDialect dialect = GetDialect(); string result = dialect.GetTableName("bar", "foo", null); Assert.AreEqual("\"bar\".\"foo\"", result); }
public void CanQueryByDateTimeOffsetUtcNow() { if (!TestDialect.SupportsSqlType(SqlTypeFactory.DateTimeOffSet)) { Assert.Ignore("Dialect does not support DateTimeOffSet"); } var isSupported = IsFunctionSupported("current_utctimestamp_offset"); RunTest( isSupported, spy => { var testDate = DateTimeOffset.UtcNow.AddDays(-1); var x = db.Orders.Count(o => testDate < DateTimeOffset.UtcNow); Assert.That(x, Is.GreaterThan(0)); AssertFunctionInSql("current_utctimestamp_offset", spy); }); }
public void CanQueryByNewGuid() { if (!TestDialect.SupportsSqlType(SqlTypeFactory.Guid)) { Assert.Ignore("Guid are not supported by the target database"); } var isSupported = IsFunctionSupported("new_uuid"); RunTest( isSupported, spy => { var guid = Guid.NewGuid(); var x = db.Orders.Count(o => guid != Guid.NewGuid()); Assert.That(x, Is.GreaterThan(0)); AssertFunctionInSql("new_uuid", spy); }); }
public void CanSelectNewGuid() { if (!TestDialect.SupportsSqlType(SqlTypeFactory.Guid)) { Assert.Ignore("Guid are not supported by the target database"); } var isSupported = IsFunctionSupported("new_uuid"); RunTest( isSupported, spy => { var x = db .Orders.Select(o => new { id = o.OrderId, g = Guid.NewGuid() }) .OrderBy(o => o.id).Take(1).ToList(); Assert.That(x, Has.Count.GreaterThan(0)); AssertFunctionInSql("new_uuid", spy); }); }
public void CanSelectDateTimeOffsetUtcNow() { if (!TestDialect.SupportsSqlType(SqlTypeFactory.DateTimeOffSet)) { Assert.Ignore("Dialect does not support DateTimeOffSet"); } var isSupported = IsFunctionSupported("current_utctimestamp_offset"); RunTest( isSupported, spy => { var x = db .Orders.Select(o => new { id = o.OrderId, d = DateTimeOffset.UtcNow }) .OrderBy(o => o.id).Take(1).ToList(); Assert.That(x, Has.Count.GreaterThan(0)); Assert.That(x[0].d.Offset, Is.EqualTo(TimeSpan.Zero)); AssertFunctionInSql("current_utctimestamp_offset", spy); }); }
protected override bool AppliesTo(Dialect.Dialect dialect) { return(TestDialect.GetTestDialect(dialect).SupportsDistributedTransactions); }
public void Setup() { Dialect = new TestDialect(); }
protected override bool AppliesTo(Dialect.Dialect dialect) { return(TestDialect.GetTestDialect(dialect).SupportsFullJoin); }
public void IsQuoted_WithQuotes_ReturnsTrue() { TestDialect dialect = GetDialect(); Assert.IsTrue(dialect.IsQuoted("\"foo\"")); }
public void Setup() { Dialect = new TestDialect(); }
protected SqlDialectBaseFixtureBase() { Dialect = new TestDialect(); }
public void EmptyTableName_ReturnsProperlyQuoted() { TestDialect dialect = GetDialect(); Assert.Throws <ArgumentNullException>(() => dialect.GetTableName(null, string.Empty, null)); }
public void QuoteString_WithBothQuote_DoesNotAddQuotes() { TestDialect dialect = GetDialect(); Assert.AreEqual("\"foo\"", dialect.QuoteString("\"foo\"")); }
public void QuoteString_WithCloseQuote_AddsQuotes() { TestDialect dialect = GetDialect(); Assert.AreEqual("\"foo\"\"", dialect.QuoteString("foo\"")); }
public void IsQuoted_WithOnlyCloseQuotes_ReturnsFalse() { TestDialect dialect = GetDialect(); Assert.IsFalse(dialect.IsQuoted("foo\"")); }
public void IsQuoted_WithOnlyStartQuotes_ReturnsFalse() { TestDialect dialect = GetDialect(); Assert.IsFalse(dialect.IsQuoted("\"foo")); }
protected override bool AppliesTo(Dialect.Dialect dialect) => TestDialect.SupportsSqlType(SqlTypeFactory.DateTimeOffSet);
public SqlDialectBaseFixtureBase() { Dialect = new TestDialect(); }
protected override bool AppliesTo(Dialect.Dialect dialect) { return(TestDialect.SupportsSqlType(new SqlType(DbType.Xml))); }
public void NullColumnName_ReturnsProperlyQuoted() { TestDialect dialect = GetDialect(); Assert.Throws <ArgumentNullException>(() => dialect.GetColumnName(null, null, null)); }