コード例 #1
0
        public IHttpActionResult Get(ODataQueryOptions <NotaFiscal> queryOptions)
        {
            var query = default(IQueryable <NotaFiscal>);

            query = _notaFiscalService.GetAll();

            return(HandleQueryable <NotaFiscal, NotaFiscalViewModel>(query, queryOptions));
        }
コード例 #2
0
        public void ApplService_NotaFiscal_GetAll_Deve_Listar_Todos_NotaFiscals()
        {
            //Arrange
            var notafiscal          = ObjectMother.NotaFiscalValidaComId;
            var repositoryMockValue = new List <NotaFiscal>()
            {
                notafiscal
            }.AsQueryable();

            _notaFiscalRepository.Setup(odr => odr.GetAll()).Returns(repositoryMockValue);
            //Action
            var notafiscalCB = _notaFiscalService.GetAll();

            //Assert
            _notaFiscalRepository.Verify(nf => nf.GetAll(), Times.Once);
            notafiscalCB.Should().NotBeNull();
            notafiscalCB.Count().Should().Be(repositoryMockValue.Count());
            //Perceba que Equals de Entity já compara os Id's
            notafiscalCB.First().Should().Be(repositoryMockValue.First());
        }