public void AdicionarMapeamento_Sobreescrever() { var factory = new GtFactory(); factory.AddMapping <IPais, PaisStub>(); factory.AddMapping <IPais, PaisStub2>(); IPais pais = factory.Instantiate <IPais>(); this.GarantirTipoDoObjeto <PaisStub2>(pais); }
public void LimparTodosMapeamentos() { var factory = new GtFactory(); factory.AddMapping <IPais, PaisStub>(); factory.AddMapping <ICidade, CidadeStub>(); factory.ClearAllMappings(); IPais pais = factory.Instantiate <IPais>(); ICidade cidade = factory.Instantiate <ICidade>(); this.GarantirTipoDoObjeto <Pais>(pais); this.GarantirTipoDoObjeto <Cidade>(cidade); }
public void EscapeFinishGameRound() { var player1 = new GtUserActionsListener(); var factory = new GtFactory(); factory.AddMapping <IAudioListener, DoubleAudioListenerDoNothing>(); var controller = new GtGameRoundController( factory, new GtGameController(new GtFileLoaderDouble6())); controller.Update(player1); controller.GameRoundState = EnumGameRoundState.Playing; KeyboardState keyboardState = new KeyboardState(Keys.Escape);; GamePadState gamePadState = new GamePadState(); player1.Update(keyboardState, gamePadState); controller.Update(player1); Assert.AreEqual(EnumGameRoundState.Finished, controller.GameRoundState); }
public void LimparMapeamento() { var factory = new GtFactory(); factory.AddMapping <IPais, PaisStub>(); factory.AddMapping <ICidade, CidadeStub>(); // O Método LimparMapeamento remove o mapeamento do tipo especificado. factory.CleanMappings <IPais>(); IPais pais = factory.Instantiate <IPais>(); ICidade cidade = factory.Instantiate <ICidade>(); this.GarantirTipoDoObjeto <Pais>(pais); this.GarantirTipoDoObjeto <CidadeStub>(cidade); }
public void StartHitedIsNotReset() { var factory = new GtFactory(); factory.AddMapping <IGtPlayedNotesAnalyserHelper, MockGtPlayedNotesAnalyserHelperAlwaysIsNotPlaying>(); var analyser = factory.Instantiate <IGtPlayedNotesAnalyser>(factory, new DoubleAudioListenerDoNothing(40)); var note = new GtSceneGuitarNote(new BeatTick(1, 0), new BeatTick(1, 240), 6, 0); var startingNotes = new List <GtSceneGuitarNote>(); startingNotes.Add(note); var expectedPlayingNotes = new List <GtSceneGuitarNote>(); expectedPlayingNotes.Add(note); note.Playing = true; note.StartHited = true; analyser.Analyse(startingNotes, expectedPlayingNotes); Assert.IsTrue(startingNotes[0].StartHited); Assert.IsFalse(startingNotes[0].Playing); }
public void Constructor_OnePlayer() { var factory = new GtFactory(); factory.AddMapping <IAudioListener, DoubleAudioListenerDoNothing>(); var controller = new GtGameRoundController( factory, new GtGameController(new GtFileLoaderDouble6())); Assert.IsNotNull(controller); }
public void SetupSong_ZeroPlayers() { var factory = new GtFactory(); factory.AddMapping <IAudioListener, DoubleAudioListenerDoNothing>(); var controller = new GtGameRoundController( factory, new GtGameController(new GtFileLoaderDouble6())); controller.SetupSong(0, new Double_SongPlayerWithTimer(new BeatTick(5, 0)), "Artist", "Album", "Song", 0.0f); }
public void SetupSong_InvalidNumberOfPlayers() { var factory = new GtFactory(); factory.AddMapping <IAudioListener, DoubleAudioListenerDoNothing>(); var controller = new GtGameRoundController( factory, new GtGameController(new GtFileLoaderDouble6())); var guitar1 = new GtSceneGuitar(new GtTickDataTable(4)); var guitar2 = new GtSceneGuitar(new GtTickDataTable(4)); controller.SetupSong(1, new Double_SongPlayerWithTimer(new BeatTick(5, 0)), "Artist", "Album", "Song", 0.0f, guitar1, guitar2); }
public void SetupSong_OnePlayer() { var factory = new GtFactory(); factory.AddMapping <IAudioListener, DoubleAudioListenerDoNothing>(); var controller = new GtGameRoundController( factory, new GtGameController(new GtFileLoaderDouble6())); var guitar1 = new GtSceneGuitar(new GtTickDataTable(4)); controller.SetupSong(1, new Double_SongPlayerWithTimer(new BeatTick(5, 0)), "Artist", "Album", "Song", 0.0f, guitar1); Assert.AreEqual(1, controller.SceneGuitars.Count()); Assert.AreSame(guitar1, controller.SceneGuitars[0]); }
public void PlayMusic() { var factory = new GtFactory(); factory.AddMapping <IAudioListener, DoubleAudioListenerDoNothing>(); var controller = new GtGameRoundController( factory, new GtGameController(new GtFileLoaderDouble6())); var guitar1 = new GtSceneGuitar(new GtTickDataTable(4)); controller.SetupSong(1, new Double_SongPlayerWithTimer(new BeatTick(5, 0)), "Artist", "Album", "Song", 0.0f, guitar1); controller.PlaySong(); Assert.AreEqual(EnumGameRoundState.Playing, controller.GameRoundState); }
public void OnePlayingNoteShouldReturn1Point() { var factory = new GtFactory(); factory.AddMapping <IGtPlayedNotesAnalyserHelper, MockGtPlayedNotesAnalyserHelperAlwaysIsPlaying>(); var analyser = factory.Instantiate <IGtPlayedNotesAnalyser>(factory, new DoubleAudioListenerDoNothing(40)); var note1 = new GtSceneGuitarNote(new BeatTick(1, 0), new BeatTick(1, 240), 6, 0); var startingNotes = new List <GtSceneGuitarNote>(); var expectedPlayingNotes = new List <GtSceneGuitarNote>(); expectedPlayingNotes.Add(note1); var points = analyser.Analyse(startingNotes, expectedPlayingNotes); Assert.AreEqual(1, points); }
public void RightArrowDecreaseVelocityByPointOne(decimal initialVelocityValue, decimal finalVelocityValue) { var player1 = new GtUserActionsListener(); var factory = new GtFactory(); factory.AddMapping <IAudioListener, DoubleAudioListenerDoNothing>(); var controller = new GtGameRoundController( factory, new GtGameController(new GtFileLoaderDouble6())); KeyboardState keyboardState = new KeyboardState(Keys.Right);; GamePadState gamePadState = new GamePadState(); player1.Update(keyboardState, gamePadState); controller.VelocityValue = initialVelocityValue; controller.Update(player1); Assert.AreEqual(finalVelocityValue, controller.VelocityValue); }
public void AnalyseMustReturnZeroIfNoNoteIsCorrect() { var factory = new GtFactory(); factory.AddMapping <IGtPlayedNotesAnalyserHelper, MockGtPlayedNotesAnalyserHelperAlwaysIsNotPlaying>(); var analyser = factory.Instantiate <IGtPlayedNotesAnalyser>(factory, new DoubleAudioListenerDoNothing(40)); var note = new GtSceneGuitarNote(new BeatTick(1, 0), new BeatTick(1, 240), 6, 0); var startingNotes = new List <GtSceneGuitarNote>(); startingNotes.Add(note); var expectedPlayingNotes = new List <GtSceneGuitarNote>(); expectedPlayingNotes.Add(note); var points = analyser.Analyse(startingNotes, expectedPlayingNotes); var maxPoints = analyser.AnalyseMaximum(startingNotes, expectedPlayingNotes); Assert.AreEqual(0, points); Assert.AreEqual(101, maxPoints); }
public void AdicionarMapeamento_InterfaceParaInterface() { var factory = new GtFactory(); factory.AddMapping <IPais, IPaisStub>(); }
public void AdicionarMapeamento_ClasseParaClasse() { var factory = new GtFactory(); factory.AddMapping <Pais, PaisStub2>(); }