public void RepositoryService_Add_Throws_On_Null_Repository()
        {
            //Arrange
            _service = new RepositoryService(_mockUnitOfWork.Object);

            //Assert
            Assert.Throws<ArgumentNullException>(() => _service.Add(null));
        }
Ejemplo n.º 2
0
 public ViewResult Index()
 {
     var context = new DataContext();
     var rfxRepository = new RepositoryService<Rfx>(context);
     var result = rfxRepository.GetById(1);
     result.Name = "Books";
     rfxRepository.Update(result);
     return View(rfxRepository.GetAll());
 }
        public void RepositoryService_Add_Calls_Repository_Add_Method_With_The_Same_Repository_Object_It_Recieved()
        {
            // Create test data
            var newRepository = new Repository
                                    {
                                        Name = "Foo",
                                        Address = "Bar"
                                    };

            //Create Mock
            var mockRepository = new Mock<IRepository<Repository>>();
            _mockUnitOfWork.Setup(d => d.GetRepository<Repository>()).Returns(mockRepository.Object);

            //Arrange
            _service = new RepositoryService(_mockUnitOfWork.Object);

            //Act
            _service.Add(newRepository);

            //Assert
            mockRepository.Verify(r => r.Add(newRepository));
        }
        public void RepositoryService_Update_Calls_UnitOfWork_Commit_Method()
        {
            // Create test data
            var individual = new Repository { Id = TestConstants.ID_Exists, Name = "Foo", Address = "Bar" };

            //Create Mock
            var mockRepository = new Mock<IRepository<Repository>>();
            _mockUnitOfWork.Setup(d => d.GetRepository<Repository>()).Returns(mockRepository.Object);

            //Arrange
            _service = new RepositoryService(_mockUnitOfWork.Object);

            //Act
            _service.Update(individual);

            //Assert
            _mockUnitOfWork.Verify(db => db.Commit());
        }
Ejemplo n.º 5
0
 public ProdutoProjeto(string organization, bool isOffline)
     : base(organization, isOffline)
 {
     RepositoryService = new RepositoryService(organization, isOffline);
 }
        public void RepositoryService_Get_ByPage_Overload_Throws_On_Negative_TreeId()
        {
            //Arrange
            _service = new RepositoryService(_mockUnitOfWork.Object);

            //Assert
            Assert.Throws<IndexOutOfRangeException>(() => _service.Get(-1, t => true, 0, TestConstants.PAGE_RecordCount));
        }
        public void RepositoryService_Get_ByPage_Overload_Returns_PagedList_Of_Repositorys()
        {
            //Arrange
            var mockRepository = new Mock<IRepository<Repository>>();
            mockRepository.Setup(r => r.Get(It.IsAny<int>())).Returns(GetRepositorys(TestConstants.PAGE_TotalCount));
            _mockUnitOfWork.Setup(u => u.GetRepository<Repository>()).Returns(mockRepository.Object);

            _service = new RepositoryService(_mockUnitOfWork.Object);
            const int treeId = TestConstants.TREE_Id;

            //Act
            var repositorys = _service.Get(treeId, t => true, 0, TestConstants.PAGE_RecordCount);

            //Assert
            Assert.IsInstanceOf<IPagedList<Repository>>(repositorys);
            Assert.AreEqual(TestConstants.PAGE_TotalCount, repositorys.TotalCount);
            Assert.AreEqual(TestConstants.PAGE_RecordCount, repositorys.PageSize);
        }
        public void RepositoryService_Get_Throws_On_Negative_Id()
        {
            //Arrange
            _service = new RepositoryService(_mockUnitOfWork.Object);

            //Assert
            Assert.Throws<IndexOutOfRangeException>(() => _service.Get(-1, It.IsAny<int>()));
        }
        public void RepositoryService_Get_Returns_Null_On_InValid_Id()
        {
            //Arrange
            var mockRepository = new Mock<IRepository<Repository>>();
            mockRepository.Setup(r => r.Get(It.IsAny<int>())).Returns(GetRepositorys(TestConstants.PAGE_TotalCount));
            _mockUnitOfWork.Setup(u => u.GetRepository<Repository>()).Returns(mockRepository.Object);

            _service = new RepositoryService(_mockUnitOfWork.Object);
            const int id = TestConstants.ID_NotFound;

            //Act
            var individual = _service.Get(id, It.IsAny<int>());

            //Assert
            Assert.IsNull(individual);
        }
Ejemplo n.º 10
0
 public ClassificacaoService(string organizacao, bool isOffline)
     : this(organizacao, isOffline, null)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline);
 }
Ejemplo n.º 11
0
 public ContratosAssociados(string organization, bool isOffline) : base(organization, isOffline)
 {
     RepositoryService = new RepositoryService(organization, isOffline);
 }
Ejemplo n.º 12
0
 public ParticipantesDoProcesso(string organization, bool isOffline, object provider)
     : base(organization, isOffline, provider)
 {
     RepositoryService = new RepositoryService(organization, isOffline, provider);
 }
 public OrcamentodoCanalporProdutoService(string organizacao, bool isOffline, object provider)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline, provider);
 }
Ejemplo n.º 14
0
 public ParticipantesDoProcesso(string organization, bool isOffline)
     : base(organization, isOffline)
 {
     RepositoryService = new RepositoryService(organization, isOffline);
 }
Ejemplo n.º 15
0
 public PhotoService(RepositoryService contextService)
 {
     _contextService = contextService;
 }
Ejemplo n.º 16
0
 public DirectoryListController(RepositoryService repositories)
 {
     this.repositories = repositories;
 }
Ejemplo n.º 17
0
 public TipoPagamentoService(string organizacao, bool isOffline)
     : this(organizacao, isOffline, null)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline);
 }
Ejemplo n.º 18
0
 public TipoPagamentoService(string organizacao, bool isOffline, object provider)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline, provider);
 }
Ejemplo n.º 19
0
 public UnidadeNegocio(RepositoryService repositoryService) : base(repositoryService.NomeDaOrganizacao, repositoryService.IsOffline, repositoryService.Provider)
 {
     RepositoryService = repositoryService;
 }
Ejemplo n.º 20
0
 public CalendarioDeFeriados(string organizacao, bool isOffline)
     : this(organizacao, isOffline, null)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline);
 }
Ejemplo n.º 21
0
 public ClassificacaoService(string organizacao, bool isOffline, object provider)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline, provider);
 }
Ejemplo n.º 22
0
 public CalendarioDeFeriados(string organizacao, bool isOffline, object provider)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline, provider);
 }
Ejemplo n.º 23
0
 public ContratosAssociados(string organization, bool isOffline, object provider) : base(organization, isOffline, provider)
 {
     RepositoryService = new RepositoryService(organization, isOffline, provider);
 }
Ejemplo n.º 24
0
 public CanalVerdeService(string organizacao, bool isOffline)
     : this(organizacao, isOffline, null)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline);
 }
        public void RepositoryService_Get_Calls_Repository_Get()
        {
            //Arrange
            var mockRepository = new Mock<IRepository<Repository>>();
            _mockUnitOfWork.Setup(u => u.GetRepository<Repository>()).Returns(mockRepository.Object);

            _service = new RepositoryService(_mockUnitOfWork.Object);
            const int id = TestConstants.ID_Exists;

            //Act
            _service.Get(id, It.IsAny<int>());

            //Assert
            mockRepository.Verify(r => r.Get(It.IsAny<int>()));
        }
Ejemplo n.º 26
0
 public CanalVerdeService(string organizacao, bool isOffline, object provider)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline, provider);
 }
        public void RepositoryService_Get_Overload_Throws_On_Negative_TreeId()
        {
            //Arrange
            _service = new RepositoryService(_mockUnitOfWork.Object);

            //Assert
            Assert.Throws<IndexOutOfRangeException>(() => _service.Get(-1));
        }
Ejemplo n.º 28
0
 public ProdutoEstabelecimento(string organization, bool isOffline, object provider)
     : base(organization, isOffline, provider)
 {
     RepositoryService = new RepositoryService(organization, isOffline, provider);
 }
        public void RepositoryService_Get_ByPage_Overload_Calls_Repository_Get()
        {
            //Arrange
            var mockRepository = new Mock<IRepository<Repository>>();
            _mockUnitOfWork.Setup(u => u.GetRepository<Repository>()).Returns(mockRepository.Object);

            _service = new RepositoryService(_mockUnitOfWork.Object);
            const int treeId = TestConstants.TREE_Id;

            //Act
            _service.Get(treeId, t => true, 0, TestConstants.PAGE_RecordCount);

            //Assert
            mockRepository.Verify(r => r.Get(It.IsAny<int>()));
        }
Ejemplo n.º 30
0
 public ProdutoEstabelecimento(string organization, bool isOffline)
     : base(organization, isOffline)
 {
     RepositoryService = new RepositoryService(organization, isOffline);
 }
        public void RepositoryService_Update_Calls_Repository_Update_Method_With_The_Same_Repository_Object_It_Recieved()
        {
            // Create test data
            var individual = new Repository { Id = TestConstants.ID_Exists, Name = "Foo", Address = "Bar" };

            //Create Mock
            var mockRepository = new Mock<IRepository<Repository>>();
            _mockUnitOfWork.Setup(d => d.GetRepository<Repository>()).Returns(mockRepository.Object);

            //Arrange
            _service = new RepositoryService(_mockUnitOfWork.Object);

            //Act
            _service.Update(individual);

            //Assert
            mockRepository.Verify(r => r.Update(individual));
        }
Ejemplo n.º 32
0
 public TurmaCanal(string organization, bool isOffline, object provider)
     : base(organization, isOffline, provider)
 {
     RepositoryService = new RepositoryService(organization, isOffline, provider);
 }
Ejemplo n.º 33
0
 public TurmaCanal(string organization, bool isOffline)
     : base(organization, isOffline)
 {
     RepositoryService = new RepositoryService(organization, isOffline);
 }
Ejemplo n.º 34
0
 public UnidadeNegocio(string organization, bool isOffline)
     : base(organization, isOffline)
 {
     RepositoryService = new RepositoryService(organization, isOffline);
 }
        public void RepositoryService_Add_Calls_UnitOfWork_Commit_Method()
        {
            // Create test data
            var newRepository = new Repository
                                    {
                                        Name = "Foo",
                                        Address = "Bar"
                                    };

            //Create Mock
            var mockRepository = new Mock<IRepository<Repository>>();
            _mockUnitOfWork.Setup(d => d.GetRepository<Repository>()).Returns(mockRepository.Object);

            //Arrange
            _service = new RepositoryService(_mockUnitOfWork.Object);

            //Act
            _service.Add(newRepository);

            //Assert
            _mockUnitOfWork.Verify(db => db.Commit());
        }
 public OrcamentodoCanalporProdutoService(string organizacao, bool isOffline)
     : this(organizacao, isOffline, null)
 {
     RepositoryService = new RepositoryService(organizacao, isOffline);
 }