public void StartTest() { DbPgSqlContext _DbContext = DbPgSqlContext.Instance(); using (var _Trns = _DbContext.Database.BeginTransaction()) { Interviwee _Interviwee = new DAO.Interviwee() { FirstName = "sdad", LastName = "adasd" }; _Interviwee = _DbContext.Interviwees.Add(_Interviwee); Test _Test = new DAO.Test() { Name = "sdasdasd" }; _Test = _DbContext.Tests.Add(_Test); _DbContext.SaveChanges(); InterviweeTests _Result = _TestingManagement.GetTesting(_Interviwee, _Test); _DbContext.SaveChanges(); Assert.True(_Result.Id > 0); _Trns.Rollback(); } }