Пример #1
0
        public void Instanciar()
        {
            var factory = new GtFactory();

            IPais          pais   = factory.Instantiate <IPais>();
            ITituloEleitor titulo = factory.Instantiate <ITituloEleitor>();

            this.GarantirTipoDoObjeto <Pais>(pais);
            this.GarantirTipoDoObjeto <TituloEleitor>(titulo);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        public void ConstructUsingTheFactory()
        {
            var factory = new GtFactory();
            var p       = factory.Instantiate <IGtPlayedNotesAnalyser>(factory, new DoubleAudioListenerDoNothing(40));

            Assert.IsNotNull(p);
        }
Пример #6
0
        public void AdicionarMapeamento()
        {
            var factory = new GtFactory();

            factory.AddMapping <IPais, PaisStub>();

            IPais pais = factory.Instantiate <IPais>();

            this.GarantirTipoDoObjeto <PaisStub>(pais);
        }
Пример #7
0
        private void Initialize(GtFactory pFactory, GtGameController pGameController)
        {
            InitializeProperties();

            this.Factory = pFactory;

            this.GameController = pGameController;

            this.PlayedNotesAnalyser = Factory.Instantiate <IGtPlayedNotesAnalyser>(this.Factory, pGameController.AudioListener);
        }
Пример #8
0
        private void Initialize(GtFactory pFactory, GtFileLoader pFileLoader, ISongPlayer pSongPlayer, IAudioEffects pAudioEffects)
        {
            this.Factory = pFactory;

            this.SongPlayer = pSongPlayer;

            this.fFileLoader = pFileLoader;

            this.AudioEffects = pAudioEffects;

            this.CurrentScreen = EnumGameScreen.Undefined;

            this.AudioListener = pFactory.Instantiate <IAudioListener>(SAMPLE_FREQUENCE);

            //must be after AudioListener instantiation
            this.GameRoundController = pFactory.Instantiate <IGtGameRoundController>(pFactory, this);

            this.TuneController = pFactory.Instantiate <IGtTuneController>();

            this.AudioListener.Start();
        }
Пример #9
0
        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);
        }
Пример #10
0
        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);
        }
Пример #11
0
        public void Instanciar_ClassePadraoNaoExiste()
        {
            var factory = new GtFactory();

            factory.Instantiate <IContrato>();
        }
Пример #12
0
        public void Instanciar_Classe()
        {
            var factory = new GtFactory();

            factory.Instantiate <Pais>();
        }