public void ClubManager_AddDuplicateClub_Exception()
        {
            ClubsManager clbMng = new ClubsManager();
            Club         club   = new Club();

            clbMng.Add(club);

            try
            {
                clbMng.Add(club);
            }
            catch (Exception e)
            {
                StringAssert.Contains(e.Message, "Club already exist!");
            }
        }
示例#2
0
        public void NumberOfClubsAreGettingAddedByNumberProperty()
        {
            //arrange
            ClubsManager aClubManager = new ClubsManager();
            Club         aClub        = new Club();
            Club         anotherClub  = new Club();

            //act
            aClubManager.Add(aClub);
            aClubManager.Add(anotherClub);
            int expexted = 2;

            //assert
            int actual = aClubManager.Number;

            Assert.AreEqual(expexted, actual);
        }
        public void Test_ClubsManager_AddMethod()
        {
            ClubsManager clubMg2 = new ClubsManager();
            Club         club1   = new Club();

            clubMg2.Add(club1);
            Assert.AreEqual(club1, clubMg2.Clubs[0]);
        }
        public void ClubManager_AddClubCorrectly_Success()
        {
            ClubsManager clbMng = new ClubsManager();
            Club         club   = new Club();

            clbMng.Add(club);

            Assert.AreEqual(clbMng.Clubs[0], club);
            Assert.AreEqual(clbMng.Number, 1);
        }
        public void Test_ClubsManager_GetClubByRegNumMethod()
        {
            ClubsManager clubMg3 = new ClubsManager();
            Club         club2   = new Club(2000, "CCAC", new Address("35 River St", "Toronto", "ON", "M2M 5M5"), 4165555555);

            clubMg3.Add(club2);
            Club clubCheck = clubMg3.GetByRegNum(2000);

            Assert.AreEqual(club2, clubCheck);
        }
        public void ClubManager_GetClubByInvalidNum_Output()
        {
            ClubsManager clbMng = new ClubsManager();
            Club         club   = new Club();

            clbMng.Add(club);

            Club newClub = clbMng.GetByRegNum(0);

            Assert.AreEqual(newClub, null);
        }
        public void ClubManager_GetClubByRegNum_Success()
        {
            ClubsManager clbMng = new ClubsManager();
            Club         club   = new Club();

            clbMng.Add(club);

            Club newClub = clbMng.GetByRegNum(club.ClubNumber);

            Assert.AreEqual(club, newClub);
        }
示例#8
0
        public void AddProperlyWorkingProperly()
        {
            //arrange
            ClubsManager aClubManager = new ClubsManager();
            Club         aClub        = new Club();

            //act
            aClubManager.Add(aClub);
            Club expected = aClub;
            //assert
            Club actual = aClubManager.Clubs[0];

            Assert.AreEqual(expected, actual);
        }
示例#9
0
        public void GetByRegNoWorkingProperly()
        {
            //arrange
            ClubsManager aClubManager = new ClubsManager();
            Address      aAddress     = new Address();
            Club         aClub        = new Club(118, "my club", aAddress, 1234567890);

            //act
            aClubManager.Add(aClub);
            Club expected = aClub;
            //assert
            Club actual = aClubManager.GetByRegNum(118);

            Assert.AreEqual(expected, actual);
        }
示例#10
0
        async void OnDismiss(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            button.IsEnabled = false;
            this.IsBusy      = true;
            try
            {
                string name    = nameCell.Text;
                string cuisine = descriptionCell.Text;

                if (string.IsNullOrWhiteSpace(name) ||
                    string.IsNullOrWhiteSpace(cuisine))
                {
                    this.IsBusy = false;
                    await this.DisplayAlert("Missing Information",
                                            "You must enter values.",
                                            "OK");
                }
                else
                {
                    if (existingclub != null)
                    {
                        existingclub.Name        = name;
                        existingclub.Description = cuisine;

                        await manager.Update(existingclub);

                        int pos = clubs.IndexOf(existingclub);
                        clubs.RemoveAt(pos);
                        clubs.Insert(pos, existingclub);
                    }
                    else
                    {
                        Clubs club = await manager.Add(name, cuisine);

                        clubs.Add(club);
                    }

                    await Navigation.PopModalAsync();
                }
            }
            finally
            {
                this.IsBusy      = false;
                button.IsEnabled = true;
            }
        }
        static void Main(string[] args)
        {
            IClubsRepository    clbMngr = new ClubsManager();
            ISwimmersRepository swmMngr = new SwimmersManager((ClubsManager)clbMngr);

            try
            {
                clbMngr.Load(@"Clubs.txt", ",");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            for (int i = 0; i < clbMngr.Number; i++)
            {
                DisplayInfo(i.ToString(), ((ClubsManager)clbMngr).Clubs[i]);
            }

            //------------------ I COMMENTED -------------------

            swmMngr.Load(@"Swimmers.txt", ",");

            for (int i = 0; i < swmMngr.Number; i++)
            {
                DisplayInfo(i.ToString(), ((SwimmersManager)swmMngr).Swimmers[i]);
            }

            //------------------- I COMMENTED --------------------


            // Create 3 swimmers
            Swimmer swimmer1;
            Swimmer swimmer2;
            Swimmer swimmer3;

            CreateSwimmers(out swimmer1, out swimmer2, out swimmer3);

            //Create two clubs
            Club club1;
            Club club2;

            CreateClubs(out club1, out club2);

            //Assigne swimmers to club
            AssigneSwimmersToClubs(swimmer1, swimmer2, swimmer3, club1, club2);

            //New code
            Coach coach1;
            Coach coach2;

            CreateCoaches(out coach1, out coach2);

            AssignCoachesAndSwimmers(coach1, coach2, swimmer1, swimmer2, swimmer3);

            //Create swim meets

            SwimMeet meet1;
            SwimMeet meet2;

            CreateSwimMeets(out meet1, out meet2);

            Event _50free1;
            Event _100fly;
            Event _200breast;
            Event _400free;
            Event _1500free;
            Event _1500free2;

            CreateEvents(out _50free1, out _100fly, out _200breast, out _400free, out _1500free, out _1500free2);

            AddEventsToSwimMeets(meet1, meet2, _50free1, _100fly, _200breast, _400free, _1500free, _1500free2);

            AddSwimmersToEvents(swimmer1, swimmer2, swimmer3, meet1, meet2,
                                _50free1, _100fly, _200breast, _400free, _1500free, _1500free2);

            SeedMeets(meet1, meet2);

            EnterTimesForSwims(swimmer1, swimmer2, swimmer3, meet1, meet2,
                               _50free1, _100fly, _200breast, _400free, _1500free, _1500free2);

            Console.WriteLine("Best time for SCM 1500  free for swimmer 1 is: {0}", swimmer1.GetBestTime(PoolType.SCM, Stroke.Freestyle, EventDistance._1500).ToString(@"mm\:ss\.ff"));
            Console.WriteLine("Best time for SCM 1500  free for swimmer 1 is: {0}", swimmer3.GetBestTime(PoolType.SCM, Stroke.Freestyle, EventDistance._1500).ToString(@"mm\:ss\.ff"));

            clbMngr.Add(club1);

            swmMngr.Add(swimmer1);
            swmMngr.Add(swimmer2);
            swmMngr.Add(swimmer3);

            clbMngr.Save("ClubsOut.txt", "|");
            swmMngr.Save("SwimmersOut.txt", "|");
        }
示例#12
0
        static void Main(string[] args)
        {
            ClubsManager    clbMngr = new ClubsManager();
            SwimmersManager swmMngr = new SwimmersManager(clbMngr);

            try
            {
                clbMngr.Load(@"C:\A2\Clubs.txt", ",");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            for (int i = 0; i < clbMngr.Number; i++)
            {
                DisplayInfo(i.ToString(), clbMngr.Clubs[i].GetInfo());
            }


            swmMngr.Load(@"C:\A2\Swimmers.txt", ",");

            for (int i = 0; i < swmMngr.Number; i++)
            {
                DisplayInfo(i.ToString(), swmMngr.Swimmers[i].GetInfo());
            }
            // Create 3 swimmers
            Registrant swimmer1;
            Registrant swimmer2;
            Registrant swimmer3;

            CreateSwimmers(out swimmer1, out swimmer2, out swimmer3);

            //Create two clubs
            Club club1;
            Club club2;

            CreateClubs(out club1, out club2);

            //club1.
            //Assigne swimmers to club
            AssigneSwimmersToClubs(swimmer1, swimmer2, swimmer3, club1, club2);

            //Create swim meets

            SwimMeet meet1;
            SwimMeet meet2;

            CreateSwimMeets(out meet1, out meet2);

            Event _50free1;
            Event _100fly;
            Event _200breast;
            Event _400free;
            Event _1500free;

            CreateEvents(out _50free1, out _100fly, out _200breast, out _400free, out _1500free);

            AddEventsToSwimMeets(meet1, meet2, _50free1, _100fly, _200breast, _400free, _1500free);

            AddSwimmersToEvents(swimmer1, swimmer2, swimmer3, meet1, meet2,
                                _50free1, _100fly, _200breast, _400free, _1500free);

            SeedMeets(meet1, meet2);

            EnterTimesForSwims(swimmer1, swimmer2, swimmer3, meet1, meet2,
                               _50free1, _100fly, _200breast, _400free, _1500free);

            clbMngr.Add(club1);

            swmMngr.Add(swimmer1);
            swmMngr.Add(swimmer2);
            swmMngr.Add(swimmer3);

            clbMngr.Save("ClubsOut.txt", "|");
            swmMngr.Save("SwimmersOut.txt", "|");
        }