public void Test_SwimmerManager_AddMethod() { ClubsManager clbMngr = new ClubsManager(); SwimmersManager swmMngr = new SwimmersManager(clbMngr); Registrant aRegistrant = new Registrant(); swmMngr.Add(aRegistrant); Assert.AreEqual(aRegistrant, swmMngr.Swimmers[0]); }
public void AddProperlyWorkingProperly() { //arrange ClubsManager aClubManager = new ClubsManager(); SwimmersManager aSwimmerManager = new SwimmersManager(aClubManager); Registrant aRegisterant = new Registrant(); //act aSwimmerManager.Add(aRegisterant); Registrant expected = aRegisterant; //assert Registrant actual = aSwimmerManager.Swimmers[0]; Assert.AreEqual(expected, actual); }
public void NumberOfSwimmersAreGettingAddedByNumberProperty() { //arrange ClubsManager aClubManager = new ClubsManager(); SwimmersManager aSwimmerManager = new SwimmersManager(aClubManager); Registrant aRegisterant = new Registrant(); //act aSwimmerManager.Add(aRegisterant); int expexted = 1; //assert int actual = aSwimmerManager.Number; Assert.AreEqual(expexted, actual); }
public void GetByRegNoWorkingProperly() { //arrange Registrant.count2 = 0; Registrant.count1 = 0; ClubsManager aClubManager = new ClubsManager(); SwimmersManager aSwimmerManager = new SwimmersManager(aClubManager); Registrant aRegisterant = new Registrant(); //act aSwimmerManager.Add(aRegisterant); Registrant expected = aRegisterant; //assert Registrant actual = aSwimmerManager.GetByRegNum(1); Assert.AreEqual(expected, actual); }
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", "|"); }
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", "|"); }