I am having a hard time seeing how to test something like the following. This method updates a record in the database. So how should this be approached, as I would like to have it update, verify the record was updated, then rollback the transaction at the end of the test?
If I just mock the database, that is a valid unit test but I am also looking for an integration test that verifies that the update actually works and that the database is updated. But I don't see how I can create a test that will roll this back, as SaveChanges() executes a commit.
So how would you suggest that I handle a unit test and an integration test for the CreateFileHistoryRecord() function?
/// Constructor. Injects the connection string and creates the OpenAccess domain model object.
/// <param name="connectionString"></param>
_connectionString = connectionString;
filename, Enumerations.ElaImportFileStatus status, Enumerations.ElaImportFileTypes fileType)
var fh =
fh.FileName = filename;
fh.FilePath = filePath;
fh.ImportFileTypeID = (
fh.Status = Convert.ToString(status);
fh.RecordsProcessed = 0;
fh.RecordsWithErrors = 0;
fh.LastUpdated = DateTime.Now;