Skip to content

Commit 5249449

Browse files
committed
test: fix verify interval assertion 🚨
1 parent 69077f5 commit 5249449

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

projeto-gerar-horario/GerarHorario-Tests/UnitTest1.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,17 @@ public void Test1()
2828
checar 18:00 -> true
2929
=======================================*/
3030
Intervalo intervalo1 = new Intervalo("18:00", "19:59");
31-
Assert.That(Intervalo.VerificarIntervalo(intervalo1, "05:00"), Is.True);
32-
Assert.That(Intervalo.VerificarIntervalo(intervalo1, "19:14"), Is.True);
33-
Assert.That(Intervalo.VerificarIntervalo(intervalo1, "19:59"), Is.True);
34-
Assert.That(Intervalo.VerificarIntervalo(intervalo1, "18:00"), Is.True);
31+
32+
Assert.Multiple(() =>
33+
{
34+
Assert.That(Intervalo.VerificarIntervalo(intervalo1, "05:00"), Is.False);
35+
36+
Assert.That(Intervalo.VerificarIntervalo(intervalo1, "19:14"), Is.True);
37+
38+
Assert.That(Intervalo.VerificarIntervalo(intervalo1, "19:59"), Is.True);
39+
40+
Assert.That(Intervalo.VerificarIntervalo(intervalo1, "18:00"), Is.True);
41+
});
3542

3643

3744

projeto-gerar-horario/GerarHorario/Dtos/Entidades/Intervalo.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ public Intervalo(string horarioInicio, string horarioFim)
1313
HorarioFim = horarioFim;
1414
}
1515

16-
public Intervalo(){
17-
18-
}
19-
2016
public override string ToString()
2117
{
2218
return $"[{HorarioInicio} - {HorarioFim}]";
@@ -28,19 +24,16 @@ public static bool VerificarIntervalo(Intervalo intervalo, TimeSpan horario){
2824
TimeSpan horarioFim = TimeSpan.Parse(intervalo.HorarioFim);
2925

3026
if ((horarioInicio <= horario) && (horario <= horarioFim)){
31-
System.Console.WriteLine("O horario "+horario+" esta dentro do intervalo " + intervalo.HorarioInicio + " - " + intervalo.HorarioFim);
3227
return true;
3328
}
3429
else{
35-
System.Console.WriteLine("O horario "+horario+" NAO esta dentro do intervalo " + intervalo.HorarioInicio + " - " + intervalo.HorarioFim);
3630
return false;
3731
}
3832
}
3933

4034
public static bool VerificarIntervalo(Intervalo intervalo, string horario){
4135

42-
TimeSpan horarioInicio = TimeSpan.Parse(intervalo.HorarioInicio);
43-
TimeSpan horarioFim = TimeSpan.Parse(intervalo.HorarioFim);
36+
4437
TimeSpan horarioConvertido = TimeSpan.Parse(horario);
4538

4639
return VerificarIntervalo(intervalo, horarioConvertido);

0 commit comments

Comments
 (0)