public void Should_Retrieve_Entity_Successfully() { var partResponse = TestDataProvider.CreateMultipartUpload(); RunDatabaseActionAndAssertionsInTransaction(partResponse, session => { session.SaveOrUpdate(partResponse); session.Flush(); session.Clear(); }, (responce, session) => { Repository repository = new Repository(session); var actual = repository.AsQueryable <MultipartUpload>(f => f.UploadId == responce.UploadId).FirstOrDefault(); Assert.IsNotNull(actual); Assert.AreEqual(partResponse, actual); }); }