public void Adding5lossesChangesPercentageTo45() { //Arrange HorseTip testAdd1 = new HorseTip("The Alamoney", RaceCourses.Ascot, new DateTime(2016, 03, 12), 1000.00m, false); HorseTip testAdd2 = new HorseTip("Holy Magoly", RaceCourses.Ayr, new DateTime(2016, 12, 02), 1000.00m, false); HorseTip testAdd3 = new HorseTip("Holy Magoly", RaceCourses.Ayr, new DateTime(2016, 12, 02), 1000.00m, false); HorseTip testAdd4 = new HorseTip("Holy Magoly", RaceCourses.Ayr, new DateTime(2016, 12, 02), 1000.00m, false); HorseTip testAdd5 = new HorseTip("Holy Magoly", RaceCourses.Ayr, new DateTime(2016, 12, 02), 1000.00m, false); dummyData.Add(testAdd1); dummyData.Add(testAdd2); dummyData.Add(testAdd3); dummyData.Add(testAdd4); dummyData.Add(testAdd5); string expected = GetSuccessRateReportString(18, 41, 44); //Act string successRate = ListEnquirer.GetSuccessRate(dummyData); //Assert Assert.IsTrue(successRate.Equals(expected)); //Revert dummyData.Remove(testAdd1); dummyData.Remove(testAdd2); dummyData.Remove(testAdd3); dummyData.Remove(testAdd4); dummyData.Remove(testAdd5); }
public void MostPopularCourseReturnsStringWithPunchestown() { //Arrange string course = "Punchestown"; //Act string mostPopularCourse = ListEnquirer.MostPopularCourse(dummyData); //Assert Assert.IsTrue(mostPopularCourse.Contains(course)); }
public void EighteenWinsOutOf36TipsEqualsASuccessRateOf50() { //Arrange string expected = GetSuccessRateReportString(18, 36, 50); //Act string successRate = ListEnquirer.GetSuccessRate(dummyData); //Assert Assert.IsTrue(successRate.Equals(expected)); }
public void PrintNoDataWhenListIsEmpty() { //Arrange string dummyData; List <HorseTip> emptyTips = new List <HorseTip>(); //Act dummyData = ListEnquirer.GetHighestAmountsWonAndLost(emptyTips); //Arrange Assert.IsTrue(dummyData.Equals("No data to display.")); }
public void PrintNoDataWhenListIsEmpty() { //Arrange string testList; List <HorseTip> emptyTips = new List <HorseTip>(); //Act testList = ListEnquirer.GetSuccessRate(emptyTips); //Arrange Assert.IsTrue(testList.Equals("No data to display.")); }
public void PrintNoDataWhenListIsNull() { //Arrange List <HorseTip> nullTips = null; string val = "No data to display."; //Act string testList = ListEnquirer.MostPopularCourse(nullTips); //Assert Assert.IsTrue(testList.Equals(val)); }
public void PrintsNoDataWhenListIsNull() { //Arrange string testList; List <HorseTip> nullTips = null; //Act testList = ListEnquirer.GetSuccessRate(nullTips); //Arrange Assert.IsTrue(testList.Equals("No data to display.")); }
public void MostPopularCourseReturnsStringWithValueOf6() { { //Arrange string val = "6"; //Act string mostPopularCourse = ListEnquirer.MostPopularCourse(dummyData); //Assert Assert.IsTrue(mostPopularCourse.Contains(val)); } }
public void PrintsNoDataWhenListIsNull() { //Arrange List <string> testList; List <HorseTip> nullTips = null; //Act testList = ListEnquirer.TipsInDateOrder(nullTips); //Arrange Assert.AreEqual(1, testList.Count); Assert.IsTrue(testList[0].Equals("No data to display.")); }
public void GetHighestAmountsWonAndLostDisplaysARecordOfTheHighestAmountsWon525_74AndLost50() { //Arrange decimal expectedHighestWon = 525.74m; decimal expectedHighestLost = 50; //Act string highestWonAndLost = ListEnquirer.GetHighestAmountsWonAndLost(dummyData); //Assert Assert.IsTrue(highestWonAndLost.Equals(GetRecordOfHighestWonAndLostStringFormat(expectedHighestWon, expectedHighestLost))); }
public void HighestAmountLostEquals50() { //Arrange decimal highestAmount; decimal expected = 50m; //Act highestAmount = ListEnquirer.GetHighestAmountLost(dummyData); //Assert Assert.AreEqual(expected, highestAmount); }
public void HighestAmountWonEquals525_74() { //Arrange decimal highestAmount; decimal expected = 525.74m; //Act highestAmount = ListEnquirer.GetHighestAmountWon(dummyData); //Assert Assert.AreEqual(expected, highestAmount); }
public void PrintNoDataWhenListIsEmpty() { //Arrange List <string> testList; List <HorseTip> emptyTips = new List <HorseTip>(); //Act testList = ListEnquirer.GetAmountTotalsByYear(emptyTips); //Arrange Assert.AreEqual(1, testList.Count); Assert.IsTrue(testList[0].Equals("No data to display.")); }
public void AmountTotalsByYearHaveOnlyTheYears2016And2017AndOnlyOnceEach() { //Arrange List <string> totalsByYear; //Act totalsByYear = ListEnquirer.GetAmountTotalsByYear(dummyData); //Assert Assert.IsTrue(totalsByYear[1].Contains("2016")); Assert.IsTrue(totalsByYear[2].Contains("2017")); //Method features a heading as its first element. so 1 + number of years (2) equals 3. Assert.AreEqual(3, totalsByYear.Count); }
public void AddingANewYearWithOnlyALosingBetShowsWinningsAt0() { //Arrange List <string> totalsByYear = new List <string>(); HorseTip testAdd1 = new HorseTip("The Alamoney", RaceCourses.Ascot, new DateTime(2019, 03, 12), 50.00m, false); dummyData.Add(testAdd1); //Act totalsByYear = ListEnquirer.GetAmountTotalsByYear(dummyData); //Assert Assert.IsTrue(totalsByYear[3].Equals(GetRecordOfAmountsByYearStringFormat(2019, 0.00m, 50m))); //Unarrange dummyData.Remove(testAdd1); }
public void TheFirst10CharachtersOfEachStringInListCanBeParsedIntoADate() { //Arrange List <string> testList = new List <string>(); //Act foreach (var item in ListEnquirer.TipsInDateOrder(dummyData)) { string date = item.Substring(0, 10); testList.Add(date); } //Assert foreach (var item in testList) { Assert.IsTrue(DateTime.TryParse(item, out _)); } }
public void AddingA1000LostBetChangesHighestAmountLostTo1000() { //Arrange decimal highestAmount; decimal expected = 1000m; HorseTip testAdd1 = new HorseTip("Holy Magoly", RaceCourses.Ayr, new DateTime(2016, 12, 02), 1000.00m, false); dummyData.Add(testAdd1); //Act highestAmount = ListEnquirer.GetHighestAmountLost(dummyData); //Assert Assert.AreEqual(expected, highestAmount); //Revert dummyData.Remove(testAdd1); }
public void TotalAmountsWonEqual_431_46_And_1196_22_WhileLostEqual_205_190_For2016And2107Respectively() { //Arrange string format = "{0, 20}"; List <string> testList; //Act testList = ListEnquirer.GetAmountTotalsByYear(dummyData); //Assert //This is the heading element of the report generated. Assert.IsTrue(testList[0].Equals(string.Format(format, "Year:") + string.Format(format, "Amount Won:") + string.Format(format, "Amount Lost:") + Environment.NewLine)); //These are the values each year Assert.IsTrue(testList[1].Equals(GetRecordOfAmountsByYearStringFormat(2016, 431.46m, 205m))); Assert.IsTrue(testList[2].Equals(GetRecordOfAmountsByYearStringFormat(2017, 1196.22m, 190m))); //Method features a heading as its first element. so 1 + number of years (2) equals 3. Assert.AreEqual(3, testList.Count); }
public void MostPopularCourseChangesToAscotWhen3BetsAreAdded() { //Arrange HorseTip testAdd1 = new HorseTip("Shake N' Bake", RaceCourses.Ascot, new DateTime(2017, 06, 21), 25.00m, false); HorseTip testAdd2 = new HorseTip("Holy Magoly", RaceCourses.Ascot, new DateTime(2017, 12, 02), 10.00m, false); HorseTip testAdd3 = new HorseTip("The Alamoney", RaceCourses.Ascot, new DateTime(2016, 03, 12), 50.00m, false); dummyData.Add(testAdd1); dummyData.Add(testAdd2); dummyData.Add(testAdd3); string course = "Ascot"; //Act string mostPopularCourse = ListEnquirer.MostPopularCourse(dummyData); //Assert Assert.IsTrue(mostPopularCourse.Contains(course)); //UnArrange dummyData.Remove(testAdd1); dummyData.Remove(testAdd2); dummyData.Remove(testAdd3); }
public void AddingBetsWithA1000changesTotalsAmountsFor2016By1000() { //Arrange List <string> testList; HorseTip testAdd1 = new HorseTip("The Alamoney", RaceCourses.Ascot, new DateTime(2016, 03, 12), 1000.00m, false); HorseTip testAdd2 = new HorseTip("Holy Magoly", RaceCourses.Ayr, new DateTime(2016, 12, 02), 1000.00m, true); dummyData.Add(testAdd1); dummyData.Add(testAdd2); //Act testList = ListEnquirer.GetAmountTotalsByYear(dummyData); //Assert Assert.IsTrue(testList[1].Equals(GetRecordOfAmountsByYearStringFormat(2016, 1431.46m, 1205m))); //Unarrange dummyData.Remove(testAdd1); dummyData.Remove(testAdd2); }
private void btnPopCourse_Click(object sender, EventArgs e) { MessageBox.Show(ListEnquirer.MostPopularCourse(HotTips.horseTips), "Most Popular Course"); }
private void btnHighestAmountBet_Click(object sender, EventArgs e) { MessageBox.Show(ListEnquirer.GetHighestAmountsWonAndLost(HotTips.horseTips), "Highest Amounts Won/Lost"); }
private void btnSuccRate_Click(object sender, EventArgs e) { MessageBox.Show(ListEnquirer.GetSuccessRate(HotTips.horseTips), "HotTipster Success Rate"); }
private void btnTotalWinLossPA_Click(object sender, EventArgs e) { DisplayText(ListEnquirer.GetAmountTotalsByYear(HotTips.horseTips)); }
private void btnDateOrder_Click(object sender, EventArgs e) { DisplayText(ListEnquirer.TipsInDateOrder(HotTips.horseTips)); }