Correction code smell de EvenementUT
continuous-integration/drone/push Build is passing Details

master
Camille TURPIN-ETIENNE 11 months ago
parent ad71f477fd
commit a727b43824

@ -4,6 +4,7 @@ using CoreLibrary.Events;
using Microsoft.VisualStudio.TestPlatform.Utilities;
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@ -24,7 +25,8 @@ namespace UnitTesting
{
Console.SetOut(sw);
Evenements.CommencerLaPartie(null, null);
Evenements.CommencerLaPartie(null, new DebutPartieEventArgs());
string consoleOutput = sw.ToString().Trim();
@ -51,10 +53,8 @@ namespace UnitTesting
Couleur couleurJeton = Couleur.BLEU;
Jeton jeton = new Jeton(couleurJeton);
AjouterJetonEventArgs eventArgs = new AjouterJetonEventArgs(jeton);
Evenements.AjouterJeton(null, eventArgs);
Evenements.AjouterJeton(null, new AjouterJetonEventArgs(jeton));
string consoleOutput = sw.ToString().Trim();
@ -74,7 +74,7 @@ namespace UnitTesting
Console.SetOut(sw);
Evenements.SupprimerDernierJeton(null, null);
Evenements.SupprimerDernierJeton(null, new SupprimerDernierJetonEventArgs());
string consoleOutput = sw.ToString().Trim();
@ -92,8 +92,9 @@ namespace UnitTesting
{
Console.SetOut(sw);
Code code = new Code(4);
Evenements.AjouterCode(null, null);
Evenements.AjouterCode(null, new AjouterCodeEventArgs(code));
string consoleOutput = sw.ToString().Trim();
@ -103,6 +104,12 @@ namespace UnitTesting
}
}
public static class Constants
{
public static readonly Joueur[] EmptyJoueurArray = Array.Empty<Joueur>();
}
[Fact]
public void TestPartieTerminee()
{
@ -112,10 +119,10 @@ namespace UnitTesting
Console.SetOut(sw);
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(new Joueur[] { }, new Joueur[] { }));
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(Constants.EmptyJoueurArray, Constants.EmptyJoueurArray));
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(new Joueur[] { new Joueur("Camille", new Plateau(4, 12)) }, new Joueur[] { }));
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(new Joueur[] { new Joueur("Camille", new Plateau(4, 12)) }, Constants.EmptyJoueurArray));
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(new Joueur[] { new Joueur("Pauline", new Plateau(4, 12)), new Joueur("Celeste", new Plateau(4, 12)) }, new Joueur[] { }));

Loading…
Cancel
Save