示例#1
0
        public async Task E_Possivel_Executar_Metodo_GetAll()
        {
            _serviceMock = new Mock <ICountryConsumerV2Service>();
            _serviceMock.Setup(m => m.GetAll()).ReturnsAsync(listaCountryDto);
            _service = _serviceMock.Object;

            var result = await _service.GetAll();

            Assert.NotNull(result);
            Assert.True(result.Count() == 10);

            var _listResult = new List <CountryDtoResult>();

            _serviceMock = new Mock <ICountryConsumerV2Service>();
            _serviceMock.Setup(m => m.GetAll()).ReturnsAsync(_listResult.AsEnumerable);
            _service = _serviceMock.Object;

            var _resultEmpty = await _service.GetAll();

            Assert.Empty(_resultEmpty);
            Assert.True(_resultEmpty.Count() == 0);
        }
示例#2
0
        public async Task <IActionResult> Get()
        {
            var result = await _service.GetAll();

            return(Ok(result));
        }