Created
December 15, 2010 17:36
-
-
Save jfromaniello/742314 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using BCS.Domain.Entities; | |
using NUnit.Framework; | |
namespace BCS.DAO.NHibernate.Tests | |
{ | |
[TestFixture] | |
public class NationalitiesDaoTests | |
{ | |
[Test] | |
public void CanInsertNationatlity() | |
{ | |
var nationalityDao = new Dao<NATIONALITY>(FixtureContext.Sessions); | |
var nationality = new NATIONALITY | |
{ | |
NATIONALITY_CODE = "BE", | |
DESCRIPTION = "Belgica" | |
}; | |
FixtureContext.ExecuteInSessionContext(() => nationalityDao.Insert()); | |
//ASSERT | |
Nationality readed; | |
FixtureContext.ExecuteInSessionContext(() => readed = nationalityDao.Get(nationality.ID)); | |
readed.Satisfy(n => n.NATIONALITY_CODE == "BE" && n.DESCRIPTION == "Belgica"); | |
} | |
[TearDown] | |
public void CleanUp() | |
{ | |
var nationalityDao = new Dao<NATIONALITY>(FixtureContext.Sessions); | |
FixtureContext.ExecuteInSessionContext(()=> | |
{ | |
var nationality = nationalityDao.GetAll(n => n.NATIONALITY_CODE == "BE").FirstOrDefault(); | |
if(nationality != null) nationalityDao.Delete(nationality); | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment