コード例 #1
0
        private void AddNewOutingToList()
        {
            Console.Clear();
            Outing outing = new Outing();

            Console.Write("Please Enter Location/Type of Event: ");
            outing.Place = Console.ReadLine();

            Console.Write("How Many Were in Attendance?(I.e. 50): ");
            outing.Attendance = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter The Date of the Event (DD/MM/YYYY): ");
            outing.Date = Convert.ToDateTime(Console.ReadLine());

            Console.Write("Enter Cost per Attendee: ");
            outing.CostPerPerson = Convert.ToInt32(Console.ReadLine());

            bool wasAdded = _repo.AddToList(outing);

            if (wasAdded)
            {
                Console.WriteLine("Outing Successfully Added");
                Console.WriteLine("Press Any Key To Continue...");
            }
        }
コード例 #2
0
        public void AddOutingToList_ShouldReturnIsTrue()
        {
            Outing            outing = new Outing();
            OutingsRepository _repo  = new OutingsRepository();

            bool addThing = _repo.AddToList(outing);

            Assert.IsTrue(addThing);
        }
コード例 #3
0
        public void OutingsRepository_AddToList_ShouldIncreaseCountByOne()
        {
            Outings royalPin = new Outings(EventType.Bowling, 15, "6/23/2018", 23.00m, 345.0m);

            _outingsList.AddToList(royalPin);

            var actual   = _outingsList.GetList().Count;
            var expected = 1;

            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void OutingsRepository_Tests_AddToList_ShouldBeCorrect()
        {
            Outing sampleOutingOne = new Outing(EventType.Golf, 20, DateTime.UtcNow, 450m);

            _outingsRepository.AddToList(sampleOutingOne);

            int actual   = sampleOutingOne.Attendance;
            int expected = 20;

            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void TotalCostAllOutings_ReturningHasValue()
        {
            Outing            _outing = new Outing();
            OutingsRepository _repo   = new OutingsRepository();

            _outing.Attendance    = 50;
            _outing.CostPerPerson = 60;
            _repo.AddToList(_outing);
            int totalSum = _repo.TotalCostAllOutings();

            bool sumHasGirth = (totalSum > 0);

            Assert.IsTrue(sumHasGirth);
        }