parent
c643255afb
commit
eade4992ea
@ -0,0 +1,24 @@
|
|||||||
|
import AgeIndice from "../Indices/AgeIndice";
|
||||||
|
import ColorIndice from "../Indices/ColorIndice";
|
||||||
|
import NbSportIndice from "../Indices/NbSportIndice";
|
||||||
|
import Person from "../Person";
|
||||||
|
import IndiceTester from "./IndiceTester";
|
||||||
|
|
||||||
|
class NbSportIndiceTester implements IndiceTester{
|
||||||
|
|
||||||
|
private nbSportIndice: NbSportIndice
|
||||||
|
|
||||||
|
constructor(nbSportIndice: NbSportIndice){
|
||||||
|
this.nbSportIndice = nbSportIndice;
|
||||||
|
}
|
||||||
|
|
||||||
|
Works(person: Person): boolean {
|
||||||
|
return this.nbSportIndice.getNbSport() == person.getSports().length
|
||||||
|
}
|
||||||
|
|
||||||
|
TestWorks(person: Person): boolean {
|
||||||
|
return this.nbSportIndice.getNbSport() == person.getSports().length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NbSportIndiceTester
|
@ -0,0 +1,23 @@
|
|||||||
|
import { GetJsonFile } from "../EnumExtender";
|
||||||
|
import Indice from "./Indice";
|
||||||
|
|
||||||
|
class NbSportIndice extends Indice {
|
||||||
|
private nbSport: number;
|
||||||
|
|
||||||
|
constructor(id: number, nbSport: number) {
|
||||||
|
super(id);
|
||||||
|
this.nbSport = nbSport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getNbSport(): number{
|
||||||
|
return this.nbSport
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implémentation de la méthode abstraite
|
||||||
|
ToString(lang: string): string {
|
||||||
|
let json = GetJsonFile(lang)
|
||||||
|
return `${json.nb_sports_indice_start} ${this.nbSport} ${json.nb_sports_indice_end}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NbSportIndice
|
Loading…
Reference in new issue