void createChampionshipEntryForCustomer(Championship championship, ScheduleEntryReservation reservation) { Exercise benchPress = Session.Load <Exercise>(new Guid("ece5dfd7-f995-45ae-bb34-067f26c4f7b4")); Exercise deadlift = Session.Load <Exercise>(new Guid("505988e1-5663-41f1-aa1a-9b92ea584263")); Exercise squad = Session.Load <Exercise>(new Guid("3e06a130-b811-4e45-9285-f087403615bf")); var championshipCustomer = new ChampionshipCustomer(); championshipCustomer.Customer = reservation.Customer; championship.Customers.Add(championshipCustomer); ChampionshipEntry entryChamp = new ChampionshipEntry(); entryChamp.Customer = championshipCustomer; entryChamp.Exercise = benchPress; championship.Entries.Add(entryChamp); if (championship.ChampionshipType == ChampionshipType.Trojboj) { entryChamp = new ChampionshipEntry(); entryChamp.Customer = championshipCustomer; entryChamp.Exercise = deadlift; championship.Entries.Add(entryChamp); entryChamp = new ChampionshipEntry(); entryChamp.Customer = championshipCustomer; entryChamp.Exercise = squad; championship.Entries.Add(entryChamp); } }
public ChampionshipEntry_v1(ChampionshipEntry v0) { this.races = v0.races; this.podiums = v0.podiums; this.wins = v0.podiums; this.DNFs = v0.podiums; this.mCurrentPosition = v0.mCurrentPosition; this.mQualifyingPositions = v0.mQualifyingPositions; this.mRacePositions = v0.mRacePositions; this.mChampionshipPositions = v0.mChampionshipPositions; this.mPoints = v0.mPoints; this.mExpectedRacePositions = v0.mExpectedRacePositions; this.mEventPositions = new int[v0.mExpectedRacePositions.Length]; this.mEntity = v0.mEntity; this.mChampionship = v0.mChampionship; }
public void DistinctResults() { var customer1 = CreateCustomer("cust", profiles[0]); var customer2 = CreateCustomer("cust1", profiles[0]); var championShip1 = CreateChampionship(profiles[0], "name1"); var benchPress = CreateExercise(Session, null, "BenchPress", "H", globalId: new Guid("ece5dfd7-f995-45ae-bb34-067f26c4f7b4")); CreateReservation(championShip1, customer1); CreateReservation(championShip1, customer2); var champCust1 = new ChampionshipCustomer(); champCust1.Customer = customer1; championShip1.Customers.Add(champCust1); var champCust2 = new ChampionshipCustomer(); champCust2.Customer = customer2; championShip1.Customers.Add(champCust2); var champCust3 = new ChampionshipCustomer(); champCust3.Customer = customer1; championShip1.Customers.Add(champCust3); var champCust4 = new ChampionshipCustomer(); champCust4.Customer = customer2; championShip1.Customers.Add(champCust4); var champGroup = new ChampionshipGroup(); champGroup.Name = "gr1"; champCust1.Group = champGroup; champCust2.Group = champGroup; champGroup.Members.Add(champCust1); champGroup.Members.Add(champCust2); championShip1.Groups.Add(champGroup); var champGroup1 = new ChampionshipGroup(); champGroup1.Name = "gr2"; champCust3.Group = champGroup1; champCust4.Group = champGroup1; champGroup1.Members.Add(champCust3); champGroup1.Members.Add(champCust4); championShip1.Groups.Add(champGroup1); var entry = new ChampionshipEntry(); entry.Customer = champCust1; entry.Exercise = benchPress; championShip1.Entries.Add(entry); var entry1 = new ChampionshipEntry(); entry1.Customer = champCust2; entry1.Exercise = benchPress; championShip1.Entries.Add(entry1); var entry3 = new ChampionshipEntry(); entry3.Customer = champCust3; entry3.Exercise = benchPress; championShip1.Entries.Add(entry3); insertToDatabase(championShip1); var profile = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile, ClientInformation); RunServiceMethod(delegate(InternalBodyArchitectService service) { var criteria = new GetChampionshipsCriteria(); var res = service.GetChampionships(data.Token, criteria, new PartialRetrievingInfo()); Assert.AreEqual(1, res.AllItemsCount); Assert.AreEqual(1, res.Items.Where(x => x.GlobalId == championShip1.GlobalId).Count()); Assert.AreEqual(3, res.Items[0].Entries.Count); Assert.AreEqual(2, res.Items[0].Groups.Count); Assert.AreEqual(4, res.Items[0].Customers.Count); Assert.AreEqual(2, res.Items[0].Groups[0].Members.Count); Assert.AreEqual(2, res.Items[0].Groups[1].Members.Count); }); }