public void Throw_if_collection_is_null() { var internalContext = new Mock <InternalContext>(); var internalSet = new Mock <InternalSetForMock <FakeEntity> >(); internalSet.Setup(i => i.InternalContext).Returns(internalContext.Object); var set = new InternalDbSet <FakeEntity>(internalSet.Object); Assert.Equal( new ArgumentNullException("entities").Message, Assert.Throws <ArgumentNullException>(() => set.RemoveRange(null)).Message); }
public void With_valid_entities_returns_the_removed_entities() { var internalContext = new Mock <InternalContext>(); var internalSet = new Mock <InternalSetForMock <FakeEntity> >(); internalSet.Setup(i => i.InternalContext).Returns(internalContext.Object); var set = new InternalDbSet <FakeEntity>(internalSet.Object); var entity1 = new FakeEntity(); var entity2 = new FakeEntity(); var retVal = (IEnumerable <FakeEntity>)set .RemoveRange(new[] { entity1, entity2 }); Assert.True(retVal.Contains(entity1)); Assert.True(retVal.Contains(entity2)); }
public override void RemoveRange(params TEntity[] entities) => _DbSet.RemoveRange(entities);