public async Task PutRecomendacaobyIDAsync_ShouldUpdateRecomendacao3Async() { Thread.Sleep(4000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForRecomendacoesPutID"); var testController = new RecomendacoesController(testContext); //Act var getRecomendacao = await testController.GetRecomendacao(3); var recomendacao = getRecomendacao.Value; recomendacao.ZonaId = "CC"; recomendacao.Data = DateTime.Parse("2022-1-1"); recomendacao.Validade = DateTime.Parse("2022-12-31"); recomendacao.Informacao = "TestRecomendacao3Updated"; var result = await testController.PutRecomendacao(3, recomendacao); var getresult = await testController.GetRecomendacao(3); //Assert var items = Assert.IsType <Recomendacao>(getresult.Value); Assert.Equal("CC", items.ZonaId); Assert.Equal(DateTime.Parse("2022-1-1"), items.Data); Assert.Equal(DateTime.Parse("2022-12-31"), items.Validade); Assert.Equal("TestRecomendacao3Updated", items.Informacao); Assert.IsType <NoContentResult>(result); }
public async Task PutPaisbyIDAsync_ShouldUpdatePaisCCAsync() { Thread.Sleep(2000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForPaisesPutID"); var testController = new PaisesController(testContext); //Act var getPais = await testController.GetPais("CC"); var pais = getPais.Value; pais.Nome = "TestPaisCCUpdated"; pais.ZonaId = "CC"; var result = await testController.PutPais("CC", pais); var getresult = await testController.GetPais("CC"); //Assert var items = Assert.IsType <Pais>(getresult.Value); Assert.Equal("TestPaisCCUpdated", items.Nome); Assert.Equal("CC", items.ZonaId); Assert.IsType <NoContentResult>(result); }
public async Task PutSurtobyIDAsync_ShouldUpdateSurto3Async() { Thread.Sleep(8000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForSurtosPutID"); var testController = new SurtosController(testContext); //Act var getSurto = await testController.GetSurto(3); var surto = getSurto.Value; surto.VirusId = 3; surto.ZonaId = "CC"; surto.DataDetecao = DateTime.Parse("2021-12-1"); surto.DataFim = DateTime.Parse("2021-12-31"); var result = await testController.PutSurto(3, surto); var getresult = await testController.GetSurto(3); //Assert var items = Assert.IsType <Surto>(getresult.Value); Assert.Equal(3, items.VirusId); Assert.Equal("CC", items.ZonaId); Assert.Equal(DateTime.Parse("2021-12-1"), items.DataDetecao); Assert.Equal(DateTime.Parse("2021-12-31"), items.DataFim); Assert.IsType <NoContentResult>(result); }
public async Task GetAllZonasAsync_ShouldReturnAllZonasAsync() { //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForZonasGetAll"); var testController = new ZonasController(testContext); //Act var result = await testController.GetZona(); //Assert var items = Assert.IsType <List <Zona> >(result.Value); Assert.Equal(3, items.Count); }
public async Task GetZonabyIDAsync_ShouldReturnZonaBBAsync() { //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForZonasGetID"); var testController = new ZonasController(testContext); //Act var result = await testController.GetZona("BB"); //Assert var items = Assert.IsType <Zona>(result.Value); Assert.Equal("BB", items.Id); }
public async Task GetVirusbyIDAsync_ShouldReturnVirus2Async() { Thread.Sleep(6000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForVirusGetID"); var testController = new VirusController(testContext); //Act var result = await testController.GetVirus(2); //Assert var items = Assert.IsType <Virus>(result.Value); Assert.Equal(2, items.Id); }
public async Task GetSurtobyIDAsync_ShouldReturnSurto2Async() { Thread.Sleep(8000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForSurtosGetID"); var testController = new SurtosController(testContext); //Act var result = await testController.GetSurto(2); //Assert var items = Assert.IsType <Surto>(result.Value); Assert.Equal(2, items.Id); }
public async Task DeleteZonaAsync_ShouldDeleteZonaBBAsync() { //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForZonasDelete"); var testController = new ZonasController(testContext); //Act var result = await testController.DeleteZona("BB"); var get = await testController.GetZona("BB"); //Assert Assert.IsType <NotFoundResult>(get.Result); Assert.IsType <NoContentResult>(result); }
public async Task PostZonaAsync_ShouldCreateNewZonaAsync() { //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForZonasPost"); var testController = new ZonasController(testContext); //Act var result = await testController.PostZona(new Zona { Id = "DD", Nome = "TestZonaDD" }); var get = await testController.GetZona("DD"); //Assert Assert.IsType <Zona>(get.Value); Assert.IsType <CreatedAtActionResult>(result.Result); }
public async Task GetRecomendacaobyIDAsync_ShouldReturnRecomendacao2Async() { Thread.Sleep(4000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForRecomendacoesGetID"); var testController = new RecomendacoesController(testContext); //Act var result = await testController.GetRecomendacao(2); //Assert var items = Assert.IsType <Recomendacao>(result.Value); Assert.Equal(2, items.Id); }
public async Task GetPaisbyIDAsync_ShouldReturnPaisBBAsync() { Thread.Sleep(2000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForPaisesGetID"); var testController = new PaisesController(testContext); //Act var result = await testController.GetPais("BB"); //Assert var items = Assert.IsType <Pais>(result.Value); Assert.Equal("BB", items.Id); }
public async Task GetAllPaisesAsync_ShouldReturnAllPaisesAsync() { Thread.Sleep(2000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForPaisesGetAll"); var testController = new PaisesController(testContext); //Act var result = await testController.GetPais(); //Assert var items = Assert.IsType <List <Pais> >(result.Value); Assert.Equal(3, items.Count); }
public async Task PostRecomendacaoAsync_ShouldCreateNewRecomendacaoAsync() { Thread.Sleep(4000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForRecomendacoesPost"); var testController = new RecomendacoesController(testContext); //Act var result = await testController.PostRecomendacao(new Recomendacao { Id = 4, ZonaId = "AA", Data = DateTime.Parse("2021-1-1"), Validade = DateTime.Parse("2021-12-31"), Informacao = "TestRecomendacao4" }); var get = await testController.GetRecomendacao(4); //Assert Assert.IsType <Recomendacao>(get.Value); Assert.IsType <CreatedAtActionResult>(result.Result); }
public async Task GetSurtoByPaisAsync_ShouldReturnAllActiveSurtosForPaisAAAsync_ActiveMeansDataFimIsNull() { Thread.Sleep(8000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForSurtosGetByPais"); var testController = new SurtosController(testContext); //Act var result = await testController.GetSurtoByPaisAsync("AA"); //Assert Assert.IsAssignableFrom <IQueryable <Surto> >(result); var list = result.ToList(); Assert.Equal(2, list.Count); }
public void GetSurtoByVirusAsync_ShouldReturnAllSurtosForVirus1Async() { Thread.Sleep(8000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForSurtosGetAllByVirus"); var testController = new SurtosController(testContext); //Act var result = testController.GetSurtosById(1); //Assert Assert.IsAssignableFrom <IQueryable <Surto> >(result); var list = result.ToList(); Assert.Equal(3, list.Count); }
public async Task PostVirusAsync_ShouldCreateNewVirusAsync() { Thread.Sleep(6000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForVirusPost"); var testController = new VirusController(testContext); //Act var result = await testController.PostVirus(new Virus { Id = 4, Nome = "TestVirus4" }); var get = await testController.GetVirus(4); //Assert Assert.IsType <Virus>(get.Value); Assert.IsType <CreatedAtActionResult>(result.Result); }
public async Task PostSurtoAsync_ShouldCreateNewSurtoAsync() { Thread.Sleep(8000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForSurtosPost"); var testController = new SurtosController(testContext); //Act var result = await testController.PostSurto(new Surto { Id = 4, VirusId = 3, ZonaId = "CC", DataDetecao = DateTime.Parse("2021-12-1"), DataFim = DateTime.Parse("2021-12-31") }); var get = await testController.GetSurto(4); //Assert Assert.IsType <Surto>(get.Value); Assert.IsType <CreatedAtActionResult>(result.Result); }
public async Task DeleteRecomendacaoAsync_ShouldDeleteRecomendacao2Async() { Thread.Sleep(4000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForRecomendacoesDelete"); var testController = new RecomendacoesController(testContext); //Act var result = await testController.DeleteRecomendacao(2); var get = await testController.GetRecomendacao(2); //Assert Assert.IsType <NotFoundResult>(get.Result); Assert.IsType <NoContentResult>(result); }
public async Task DeleteVirusAsync_ShouldDeleteVirus2Async() { Thread.Sleep(6000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForVirusDelete"); var testController = new VirusController(testContext); //Act var result = await testController.DeleteVirus(2); var get = await testController.GetVirus(2); //Assert Assert.IsType <NotFoundResult>(get.Result); Assert.IsType <NoContentResult>(result); }
public async Task DeletePaisAsync_ShouldDeletePaisBBAsync() { Thread.Sleep(2000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForPaisesDelete"); var testController = new PaisesController(testContext); //Act var result = await testController.DeletePais("BB"); var get = await testController.GetPais("BB"); //Assert Assert.IsType <NotFoundResult>(get.Result); Assert.IsType <NoContentResult>(result); }
public async Task GetRecomendacaoByPaisAsync_ShouldReturnAllRecomendacoesForPaisAAAsync() { Thread.Sleep(4000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForRecomendacoesGetByPais"); var testController = new RecomendacoesController(testContext); //Act var result = await testController.GetRecomendacaoByPaisAsync("AA"); //Assert Assert.IsAssignableFrom <IQueryable <Recomendacao> >(result); var list = result.ToList(); Assert.Equal(3, list.Count); }
public async Task PostPaisAsync_ShouldCreateNewPaisAsync() { Thread.Sleep(2000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForPaisesPost"); var testController = new PaisesController(testContext); //Act var result = await testController.PostPais(new Pais { Id = "DD", Nome = "TestPaisDD", ZonaId = "CC" }); var get = await testController.GetPais("DD"); //Assert Assert.IsType <Pais>(get.Value); Assert.IsType <CreatedAtActionResult>(result.Result); }
public async Task PutZonabyIDAsync_ShouldUpdateZonaCCAsync() { //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForZonasPutID"); var testController = new ZonasController(testContext); //Act var getZona = await testController.GetZona("CC"); var zona = getZona.Value; zona.Nome = "TestZonaCCUpdated"; var result = await testController.PutZona("CC", zona); var getresult = await testController.GetZona("CC"); //Assert var items = Assert.IsType <Zona>(getresult.Value); Assert.Equal("TestZonaCCUpdated", items.Nome); Assert.IsType <NoContentResult>(result); }
public async Task PutVirusbyIDAsync_ShouldUpdateVirus3Async() { Thread.Sleep(6000); //Arrange var testContext = OMSContextMocker.GetOMSContext("DBTestForVirusPutID"); var testController = new VirusController(testContext); //Act var getVirus = await testController.GetVirus(3); var virus = getVirus.Value; virus.Nome = "TestVirus3Updated"; var result = await testController.PutVirus(3, virus); var getresult = await testController.GetVirus(3); //Assert var items = Assert.IsType <Virus>(getresult.Value); Assert.Equal("TestVirus3Updated", items.Nome); Assert.IsType <NoContentResult>(result); }