public async Task Get_com_id_inexistente_deverá_retornar_NOTFOUND() { //Arrange var id = 4; var repo = new EmpresaRepositorioStub(); var controller = new EmpresasController(repo); //Action var result = await controller.Get(id) as NotFoundResult; //Assert Assert.IsNotNull(result); controller.Dispose(); repo.Dispose(); }
public async Task Get_deverá_retornar_todos_as_empresas() { //Arrange var repo = new EmpresaRepositorioStub(); var controller = new EmpresasController(repo); //Action var result = await controller.Get() as OkNegotiatedContentResult <List <Empresa> >; //Assert Assert.IsNotNull(result); Assert.AreEqual(repo.Todos().Count(), result.Content.Count); controller.Dispose(); repo.Dispose(); }
public async Task Get_com_id_deverá_retornar_a_empresa_desejada() { //Arrange var id = 1; var repo = new EmpresaRepositorioStub(); var controller = new EmpresasController(repo); //Action var result = await controller.Get(id) as OkNegotiatedContentResult <Empresa>; //Assert Assert.IsNotNull(result); Assert.AreEqual(repo.ObterPorId(id), result.Content); controller.Dispose(); repo.Dispose(); }