Beispiel #1
0
        public void Test_Coach_ClubProperty()
        {
            Club  aClub  = new Club();
            Coach aCoach = new Coach();

            aClub.AddCoach(aCoach);
            Assert.AreEqual(aCoach, aClub.Coaches[0]);
        }
Beispiel #2
0
        public void Test_Swimmer_CoachProperty()
        {
            Coach aCoach = new Coach("Micael Phelps", new DateTime(1975, 6, 30), new Address("5 Queen St", "Boston", "ON", "M1L 6Y7"), 3123123333);//6
            Club  aClub  = new Club();

            aClub.Name = "another club";
            aClub.AddCoach(aCoach);
            Club    bClub    = new Club();
            Swimmer aSwimmer = new Swimmer();

            bClub.AddSwimmer(aSwimmer);
            aSwimmer.Coach = aCoach;
        }
Beispiel #3
0
        public void Test_Coach_AddSwimmerDifferentClubException()
        {
            Coach aCoach = new Coach("Micael Phelps", new DateTime(1975, 6, 30), new Address("5 Queen St", "Boston", "ON", "M1L 6Y7"), 3123123333);//6
            Club  aClub  = new Club();

            aClub.Name = "Cool new club3";
            aClub.AddCoach(aCoach);
            Club    bClub    = new Club();
            Swimmer aSwimmer = new Swimmer();

            bClub.AddSwimmer(aSwimmer);
            aCoach.AddSwimmer(aSwimmer);
        }
Beispiel #4
0
        public void Test_Coach_AddSwimmerMethods()
        {
            Coach aCoach = new Coach("Micael Phelps", new DateTime(1975, 6, 30), new Address("5 Queen St", "Boston", "ON", "M1L 6Y7"), 3123123333);
            Club  aClub  = new Club();

            aClub.Name = "Cool new club";
            aClub.AddCoach(aCoach);
            Swimmer aSwimmer = new Swimmer();

            aSwimmer.Name = "Randalph";
            aClub.AddSwimmer(aSwimmer);
            aCoach.AddSwimmer(aSwimmer);
            Assert.AreEqual(aSwimmer.Name, aCoach.Swimmers[0].Name);
        }
Beispiel #5
0
        public void AddSwimmerMethodGivingExceptionWhenCoachIsNotRegisteredToTheSameClubAsThatOfSwimmer()
        {
            //arrange
            Club.count = 0;
            Swimmer aSwimmer = new Swimmer();
            Club    aClub    = new Club();
            Coach   aCoach   = new Coach("dave", new DateTime(), new Address(), 1234567890);

            //act
            aClub.AddCoach(aCoach);
            //aClub.AddSwimmer(aSwimmer);
            aCoach.AddSwimmer(aSwimmer);
            Swimmer expected = aSwimmer;
            //Assert
        }
Beispiel #6
0
        public void AssignedClubToCoachGivesRightClubObject()
        {
            //arrange
            Club.count = 0;
            Coach aCoach = new Coach("dave", new DateTime(), new Address(), 1234567890);
            Club  aClub  = new Club();

            //act
            aClub.AddCoach(aCoach);
            Club expected = aClub;
            //Assert
            Club actual = aCoach.AssignedClubToCoach;

            Assert.AreEqual(expected, actual);
        }
Beispiel #7
0
        public void CoachIsAssignedToClubWorksCorrect()
        {
            //arrange
            Club.count = 0;
            Coach aCoach = new Coach("dave", new DateTime(), new Address(), 1234567890);
            Club  aClub  = new Club();

            //act
            aClub.AddCoach(aCoach);
            bool expected = true;
            //Assert
            bool actual = aCoach.CoachIsAssignedToClub;

            Assert.AreEqual(expected, actual);
        }
Beispiel #8
0
        public void AddSwimmerMethodWorkingProperly()
        {
            //arrange
            Club.count = 0;
            Swimmer aSwimmer = new Swimmer();
            Club    aClub    = new Club();
            Coach   aCoach   = new Coach("dave", new DateTime(), new Address(), 1234567890);

            //act
            aClub.AddCoach(aCoach);
            aClub.AddSwimmer(aSwimmer);
            aCoach.AddSwimmer(aSwimmer);
            Swimmer expected = aSwimmer;
            //Assert
            Swimmer actual = aCoach.listOfSwimmers[0];

            Assert.AreEqual(expected, actual);
        }