示例#1
0
            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);
            }
示例#2
0
            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));
            }
示例#3
0
 public override void RemoveRange(params TEntity[] entities) => _DbSet.RemoveRange(entities);