Beispiel #1
0
        public async Task E_Possivel_Executar_Metodo_Get()
        {
            _serviceMock = new Mock <IRegistroService>();
            _serviceMock.Setup(m => m.Get(IdMunicipio)).ReturnsAsync(municipioDto);
            _service = _serviceMock.Object;

            var result = await _service.Get(IdMunicipio);

            Assert.NotNull(result);
            Assert.True(result.Id == IdMunicipio);
            Assert.Equal(NomeMunicipio, result.Nome);
            Assert.Equal(CodigoIBGEMunicipio, result.CodIBGE);

            _serviceMock = new Mock <IRegistroService>();
            _serviceMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(Task.FromResult((RegistroDto)null));
            _service = _serviceMock.Object;

            var _record = await _service.Get(Guid.NewGuid());

            Assert.Null(_record);
        }