Skip to content

Instantly share code, notes, and snippets.

@ronnieoverby
Created April 14, 2014 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronnieoverby/10641883 to your computer and use it in GitHub Desktop.
Save ronnieoverby/10641883 to your computer and use it in GitHub Desktop.
public abstract class Testing : DbConnectionWrapper
{
public bool CtorCalled { get; set; }
protected Testing(IDbConnection innerConnection)
: base(innerConnection)
{
CtorCalled = true;
}
}
[Test]
public void Abstract_Class_Ctor_Called_With_Inner_Connection()
{
var t = _conn.As<Testing>();
Assert.True(t.CtorCalled); // fails
}
[Test]
public void Abstract_Class_Has_Inner_Connection()
{
var t = _conn.As<Testing>();
// throws null reference exception
var connectionString = t.ConnectionString;
Assert.NotNull(connectionString);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment