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); }