Beispiel #1
0
        public void DeleteEntities_ItemsBySelection_ReturnsMultipleRowsDeleted()
        {
            var repositoryProvider = new Mock <IRepositoryProvider>();
            var definitionProvider = new DataAnnotationsDefinitionProvider();

            repositoryProvider.Setup(provider => provider.EntityDefinitionProvider).Returns(definitionProvider);
            repositoryProvider.Setup(provider => provider.Delete(It.IsAny <IEntitySet>())).Returns(5);

            int actual;

            using (var provider = repositoryProvider.Object)
            {
                var repository = new EntityRepository <SubSubEntity, SubSubRow>(provider, this.mapper);
                actual = repository.DeleteEntities(set => set.Where(filterSet => filterSet.AreEqual(entity => entity.UniqueName, "bar")));
            }

            Assert.AreEqual(5, actual);
        }