public void Dispose_Context() { TestingContext testingContext = Substitute.For <TestingContext>(); new AuditLogger(testingContext).Dispose(); testingContext.Received().Dispose(); }
public void Dispose_Context() { TestingContext testingContext = Substitute.For <TestingContext>(); new UnitOfWork(testingContext).Dispose(); testingContext.Received().Dispose(); }
public void Commit_SavesChanges() { TestingContext testingContext = Substitute.For <TestingContext>(); new UnitOfWork(testingContext).Commit(); testingContext.Received().SaveChanges(); }
public void Dispose_Context() { TestingContext context = Substitute.For <TestingContext>(); UnitOfWork unitOfWork = new UnitOfWork(context); unitOfWork.Dispose(); context.Received().Dispose(); }
public void Commit_SavesChanges() { TestingContext context = Substitute.For <TestingContext>(); UnitOfWork unitOfWork = new UnitOfWork(context); unitOfWork.Commit(); context.Received().SaveChanges(); }
public void Dispose_Context() { TestingContext context = Substitute.For <TestingContext>(); AuditLogger logger = new AuditLogger(context); logger.Dispose(); context.Received().Dispose(); }
public void Save_Logs() { TestingContext context = Substitute.For <TestingContext>(); logger = Substitute.ForPartsOf <AuditLogger>(context); logger.Save(); context.Received().SaveChanges(); }
public void Dispose_Context() { TestingContext testingContext = Substitute.For <TestingContext>(); testingContext.ChangeTracker.Returns(context.ChangeTracker); new AuditLogger(testingContext, 0).Dispose(); testingContext.Received().Dispose(); }
public void InsertRange_AddsModelsToDbSet() { IEnumerable <TestModel> models = new[] { ObjectsFactory.CreateTestModel(1), ObjectsFactory.CreateTestModel(2) }; TestingContext testingContext = Substitute.For <TestingContext>(); testingContext.When(sub => sub.AddRange(models)).DoNotCallBase(); unitOfWork.Dispose(); unitOfWork = new UnitOfWork(testingContext); unitOfWork.InsertRange(models); testingContext.Received().AddRange(models); }