public async Task Valores_ValoresDiferentes() { // In-memory database only exists while the connection is open var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); try { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseSqlite(connection) .Options; using (var context = new ApplicationDbContext(options)) { context.Database.EnsureCreated(); } //Verificar Erro LEFT Vaziio using (var context = new ApplicationDbContext(options)) { var dado = new Dado() { Left = "testando minha aplicaçaa", Right = "testando minna aplicacão" }; var service = new DiferencaController(context); await service.Post_Left(dado); await service.Post_Right(dado); var retorno = await service.Get_Diferenca(); Assert.IsType <Dado>(retorno.Value); Assert.Equal("REPROVADO", ((Dado)retorno.Value).Situacao); Assert.Equal("Valor Left e Right possuem alteracao do(s) carastere(s) h/n - çaa/cão nos respectivos caracteres de número 13 - 22", ((Dado)retorno.Value).Descricao); } } finally { connection.Close(); } }
public async Task Valores_TamanhosDiferentes() { // In-memory database only exists while the connection is open var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); try { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseSqlite(connection) .Options; using (var context = new ApplicationDbContext(options)) { context.Database.EnsureCreated(); } //Verificar Erro LEFT Vaziio using (var context = new ApplicationDbContext(options)) { var dado = new Dado() { Left = "aaaaabbbbbccccc", Right = "aaaaabbbbbcccc" }; var service = new DiferencaController(context); await service.Post_Left(dado); await service.Post_Right(dado); var retorno = await service.Get_Diferenca(); Assert.IsType <Dado>(retorno.Value); Assert.Equal("REPROVADO", ((Dado)retorno.Value).Situacao); Assert.Equal("Valor Left e Right pussuem tamanhos diferentes!", ((Dado)retorno.Value).Descricao); } } finally { connection.Close(); } }
public async Task Erro_RigthVazio() { // In-memory database only exists while the connection is open var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); try { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseSqlite(connection) .Options; using (var context = new ApplicationDbContext(options)) { context.Database.EnsureCreated(); } //Verificar Erro LEFT Vaziio using (var context = new ApplicationDbContext(options)) { var dado = new Dado() { Left = "Teste 1 insert Left" }; var service = new DiferencaController(context); var retorno = await service.Post_Left(dado); Assert.IsType <Retorno>(retorno.Value); retorno = await service.Get_Diferenca(); Assert.Equal("RIGHT_VAZIO", ((Retorno)retorno.Value).Situacao); } } finally { connection.Close(); } }