Exemple #1
0
        public void ShouldThrowWhenGymFull()
        {
            var gym        = new Gym("weights bg", 1);
            var athlete    = new Athlete("apu");
            var athleteTwo = new Athlete("apu's bro");

            gym.AddAthlete(athlete);

            Assert
            .Throws <InvalidOperationException>(() => gym.AddAthlete(athleteTwo));
        }
Exemple #2
0
        public void AddAthlete_ThrowsException()
        {
            Gym     gym     = new Gym("Gym", 0);
            Athlete athlete = new Athlete("Nacepena Batka");

            Assert.Throws <InvalidOperationException>(() => gym.AddAthlete(athlete));
        }
Exemple #3
0
        public void InjureAthlete_ThrowsException()
        {
            Gym     gym     = new Gym("Gym", 5);
            Athlete athlete = new Athlete("Nacepena Batka");

            gym.AddAthlete(athlete);
            Assert.Throws <InvalidOperationException>(() => gym.InjureAthlete("Fantomas"));
        }
Exemple #4
0
        public void AddAthlete_SuccessfullyIsAdded()
        {
            Gym     gym     = new Gym("Gym", 5);
            Athlete athlete = new Athlete("Nacepena Batka");

            gym.AddAthlete(athlete);
            Assert.AreEqual(1, gym.Count);
        }
Exemple #5
0
        public void ShouldAddAthleteWhenValid()
        {
            var gym     = new Gym("weights bg", 5);
            var athlete = new Athlete("apu");

            gym.AddAthlete(athlete);

            Assert.AreEqual(1, gym.Count);
        }
Exemple #6
0
        public void ShouldRemoveWhenAthleteFound()
        {
            var gym     = new Gym("weights bg", 1);
            var athlete = new Athlete("khabib");

            gym.AddAthlete(athlete);
            gym.RemoveAthlete("khabib");

            Assert.Zero(gym.Count);
        }
Exemple #7
0
        public void ShouldThrowWhenAthleteToInjureNotFound()
        {
            var gym     = new Gym("weights bg", 1);
            var athlete = new Athlete("apu");

            gym.AddAthlete(athlete);

            Assert
            .Throws <InvalidOperationException>(() => gym.InjureAthlete("404"));
        }
Exemple #8
0
        public void Report_SuccessfullyReported()
        {
            Gym     gym     = new Gym("Gym", 5);
            Athlete athlete = new Athlete("Nacepena Batka");
            string  report  = $"Active athletes at Gym: Nacepena Batka";

            gym.AddAthlete(athlete);
            var result = gym.Report();

            Assert.AreEqual(report, result);
        }
Exemple #9
0
        public void ShouldInjureAthleteWhenDataValid()
        {
            var gym     = new Gym("weights bg", 1);
            var athlete = new Athlete("khabib");

            gym.AddAthlete(athlete);
            var injured = gym.InjureAthlete("khabib");

            Assert.True(athlete.IsInjured);
            Assert.AreSame(athlete, injured);
        }
Exemple #10
0
        public void ShouldReport()
        {
            var gym     = new Gym("weights bg", 1);
            var athlete = new Athlete("khabib");

            gym.AddAthlete(athlete);
            var report = gym.Report();

            Assert.NotNull(report);
            Assert.True(report.Contains("Active athletes at weights bg: khabib"));
        }
Exemple #11
0
        public void InjureAthlete_SuccessfullyIsInjured()
        {
            Gym     gym     = new Gym("Gym", 5);
            Athlete athlete = new Athlete("Nacepena Batka");

            gym.AddAthlete(athlete);
            var result = gym.InjureAthlete("Nacepena Batka");

            Assert.AreEqual(1, gym.Count);
            Assert.AreEqual(true, result.IsInjured);
            Assert.AreEqual("Nacepena Batka", result.FullName);
        }