Skip to content

Instantly share code, notes, and snippets.

@xenda
Created June 6, 2012 14:15
Show Gist options
  • Save xenda/2882107 to your computer and use it in GitHub Desktop.
Save xenda/2882107 to your computer and use it in GitHub Desktop.
/// Using NUnit
[TestFixture]
public class HibernateTitleDaoTests : AbstractDependencyInjectionSpringContextTests {
// this instance will be (automatically) dependency injected
private HibernateTitleDao titleDao;
// a setter method to enable DI of the 'titleDao' instance variable
public HibernateTitleDao HibernateTitleDao {
set { titleDao = value; }
}
[Test]
public void LoadTitle() {
Title title = this.titleDao.LoadTitle(10);
Assert.IsNotNull(title);
}
// specifies the Spring configuration to load for this test fixture
protected override string[] ConfigLocations {
return new String[] { "assembly://MyAssembly/MyNamespace/daos.xml" };
}
}
require 'test_helper'
class TitleTest < ActiveSupport::TestCase
subject{ Title.new }
it "loads title" do
subject.should_not be_nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment