Exemplo n.º 1
0
        public void CanUseTheUnitOfWorkToGetCustomRepositoryFrom()
        {
            Mock <IPersonRepository> mockCustomRepository = new Mock <IPersonRepository>();

            MockRepositoryProvider.Setup(rp => rp.GetRepository <IPersonRepository>(null)).Returns(mockCustomRepository.Object);

            var uow = new TestUoW(MockRepositoryProvider.Object, MockDbContextFactory.Object);

            var customRepository = uow.CustomRepository;

            Assert.IsNotNull(customRepository);
        }
Exemplo n.º 2
0
        public void CanUseTheUnitOfWorkToGetGenericRepository()
        {
            Mock <IRepository <Person> > mockGenericRepository = new Mock <IRepository <Person> >();

            MockRepositoryProvider.Setup(rp => rp.GetRepositoryForEntityType <Person>()).Returns(mockGenericRepository.Object);

            var uow = new TestUoW(MockRepositoryProvider.Object, MockDbContextFactory.Object);

            var genericRepository = uow.GenericRepository;

            Assert.IsNotNull(genericRepository);
        }