This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.post('/', (request, response) => { | |
//Se o usuário mandar os campos necessários cadastra | |
if (request.body.titulo && request.body.text) { | |
bancoDeDados.conexao.query(`insert into Categoria (Titulo, Text) values('${request.body.titulo}', '${request.body.text}')`, | |
(erro, resultado) => { | |
if (!erro)//Se não tiver erros! | |
response.status(200); | |
else | |
response.status(400).json({ Erro: erro }); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('Deve dar erro ao calcula valor com desconto negativo ou zero', () { | |
expect(() => calcularDesconto(valorSemDesconto, -1, true), | |
throwsA(TypeMatcher<ArgumentError>())); | |
expect(() => calcularDesconto(valorSemDesconto, 0, false), | |
throwsA(TypeMatcher<ArgumentError>())); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:test/test.dart'; | |
import '../descontos.dart'; | |
void main() { | |
const valorSemDesconto = 150.0; | |
test('Deve clacular desconto corretamente utilizando valores decimais', () { | |
const desconto = 25.0; | |
const valorComDesconto = valorSemDesconto - desconto; | |
expect(calcularDesconto(valorSemDesconto, desconto, false), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('Deve clacular desconto corretamente utilizando valores decimais', () { | |
const desconto = 25.0; | |
const valorSemDesconto = 150.0; | |
const valorComDesconto = valorSemDesconto - desconto; | |
expect( | |
calcularDesconto(valorSemDesconto, desconto, false), valorComDesconto); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double calcularDesconto( | |
double valorInicial, double desconto, bool ehPorcentagem) { | |
if (desconto <= 0) | |
throw new ArgumentError("O desconto deve ser maior que zero!"); | |
if (valorInicial <= 0) | |
throw new ArgumentError("O valor inicial deve ser maior que zero!"); | |
if (ehPorcentagem) { | |
return valorInicial - (valorInicial * desconto / 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
//Estruturas | |
struct jogador { | |
int numCam, numGol; | |
}; | |
struct equipe { | |
int ano; | |
struct jogador jog[5]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media print { | |
* { | |
background: transparent !important; | |
color: #000 !important; | |
text-shadow: none !important; | |
filter: none !important; | |
-ms-filter: none !important; | |
} | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using CommandLine; | |
namespace parametros | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using CommandLine; | |
namespace parametros | |
{ | |
public class Options | |
{ | |
[Option('v', "verbose", Required = false, HelpText = "Executar mostrando detalhes")] | |
public bool Verbose { get; set; } | |
[Option('c', "color", Required = false, HelpText = "Cor da fonte")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace parametros | |
{ | |
public class Options | |
{ | |
public bool Verbose { get; set; } | |
public string Color { get; set; } | |
public string Title { get; set; } |