public ScoreUpdater()
    {
        enemy1 = new EasyA();
        enemy2 = new EasyB();
        enemy3 = new HardA();
        enemy4 = new HardB();

        enemy3.setSuccessor(enemy4);
        enemy2.setSuccessor(enemy3);
        enemy1.setSuccessor(enemy2);        

    }
Exemple #2
0
        public void AddStudentWithStub()
        {
            float   score        = 8.5f;
            Student dummyStudent = new Student();

            IScoreUpdater scoreUpdaterMock =
                MockRepository.GenerateStrictMock <IScoreUpdater>();

            scoreUpdaterMock.Expect(
                y => y.UpdateScore(dummyStudent, score)).Return(dummyStudent);
            //Realizamos un Stub del Datamaneger que en este test nos da igual.
            IDataManager dataManagerMock =
                MockRepository.GenerateStrictMock <IDataManager>();

            dataManagerMock.Stub(
                x => x.Save(dummyStudent));
        }
        public void AddStudentScore3()
        {
            float         score            = 8.5f;
            Student       dummyStudent     = new Student();
            IScoreUpdater scoreUpdaterMock =
                MockRepository.GenerateStrictMock <IScoreUpdater>();

            scoreUpdaterMock.Expect(y => y.UpdateScore(dummyStudent, score)).Return(dummyStudent);
            IDataManager dataManagerMock = MockRepository.GenerateMock <IDataManager>();

            dataManagerMock.Expect(x => x.Save(dummyStudent));
            ScoreManager smanager = new ScoreManager(dataManagerMock, scoreUpdaterMock);

            smanager.AddScore3(dummyStudent, score);
            dataManagerMock.VerifyAllExpectations();
            scoreUpdaterMock.VerifyAllExpectations();
        }
Exemple #4
0
 public void setSuccessor(IScoreUpdater successor)
 {
     this.successor = successor;
 }
 public ScoreManager(IDataManager dataManager, IScoreUpdater scoreUpdaterMock)
 {
     _dataManager      = dataManager;
     _scoreUpdaterMock = scoreUpdaterMock;
 }
 public ScoreManagerResponsabilityOk(IDataManager dataManager,
                                     IScoreUpdater scoreUpdater)
 {
     this.dataManager  = dataManager;
     this.scoreUpdater = scoreUpdater;
 }