Beispiel #1
0
        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);
        }
Beispiel #2
0
        public void ValidFieldsReturnEnumErrorNoneAndCanMakeAHorseTip()
        {
            //Arrange
            HorseTipDataValidator validator;
            HorseTip horseTip;

            //Act
            validator = new HorseTipDataValidator("Friday", RaceCourses.Aintree, "20/03/2020", "12.58");
            horseTip  = new HorseTip(validator.ValidHorseName, validator.ValidRacecourse, validator.ValidDateOfRace, validator.ValidAmountWonOrLost, true);
            //Assert
            Assert.IsTrue(validator.Error == error.none);
            Assert.IsNotNull(horseTip);
        }
        private void btnAddBet_Click(object sender, EventArgs e)
        {
            HorseTip horseTip = new HorseTip(TipValidator.ValidHorseName, TipValidator.ValidRacecourse,
                                             TipValidator.ValidDateOfRace, TipValidator.ValidAmountWonOrLost, cbRaceIsWon.Checked);

            MessageBox.Show($"Bet Created!! {Environment.NewLine}" +
                            $"{horseTip.ToStringInDetail()}", "Bet Created!");
            HotTips.horseTips.Add(horseTip);
            ToggleButtonsEnabled(true, false);
            lstRaceCourses.SelectionMode = SelectionMode.One;
            MakeFieldsReadOnly(false);
            hasCheckedBox = false;
            ClearTbs();
        }
        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);
        }
Beispiel #5
0
        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 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);
        }
Beispiel #7
0
        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);
        }