コード例 #1
0
ファイル: ProgramUI.cs プロジェクト: kinnejs/Gold_Challenges
        public void SeedContent()
        {
            Outings julyGolf        = new Outings("JulyGolf", OutingType.Golf, 30, DateTime.Parse("7/13/20"), 100.00);
            Outings marchBowling    = new Outings("MarchBowling", OutingType.Bowling, 25, DateTime.Parse("3/20/20"), 20.00);
            Outings augustAmusement = new Outings("AugustAmusement", OutingType.AmusementPark, 20, DateTime.Parse("8/22/20"), 150.00);
            Outings decemberConcert = new Outings("DecemberConcert", OutingType.Concert, 10, DateTime.Parse("12/15/20"), 75);

            _outingsRepo.AddOuting(julyGolf);
            _outingsRepo.AddOuting(marchBowling);
            _outingsRepo.AddOuting(augustAmusement);
            _outingsRepo.AddOuting(decemberConcert);
        }
コード例 #2
0
        public void Arrange()
        {
            _repo    = new OutingsRepo();
            _outings = new Outings("JulyGolf", OutingType.Golf, 30, DateTime.Parse("7/13/2020"), 100.00);

            _repo.AddOuting(_outings);
        }
コード例 #3
0
        public void AddToList_ShouldBeNotNull()
        {
            //Arange
            Outings outing = new Outings();

            outing.OutingName = "JulyGolf";
            OutingsRepo repo = new OutingsRepo();

            //Act
            repo.AddOuting(outing);
            Outings itemFromDir = repo.GetOutingByName("JulyGolf");

            //Assert
            Assert.IsNotNull(itemFromDir);
        }
コード例 #4
0
        private void AddOuting()
        {
            Console.Clear();
            Outing newOuting = new Outing();

            Console.WriteLine("What is the event type?\n" +
                              "1. Amusement Park\n" +
                              "2. Bowling\n" +
                              "3. Golf\n" +
                              "4. Concert");
            string input = Console.ReadLine();

            switch (input)
            {
            case "1":
                newOuting.EventType = EventType.AmusementPark;
                break;

            case "2":
                newOuting.EventType = EventType.Bowling;
                break;

            case "3":
                newOuting.EventType = EventType.Golf;
                break;

            case "4":
                newOuting.EventType = EventType.Concert;
                break;

            default:
                Console.WriteLine("Please enter a valid number 1-4");
                break;
            }

            Console.WriteLine("How many people attended?");
            int numberOfPeople = Convert.ToInt32(Console.ReadLine());

            newOuting.NumberOfPeople = numberOfPeople;

            Console.WriteLine("What is the date of the event?(YYYY,MM,DD): ");
            DateTime eventDate = Convert.ToDateTime(Console.ReadLine());

            newOuting.Date = eventDate;

            Console.WriteLine("How much did the event cost?: ");
            string cost = Console.ReadLine();

            if (cost.Contains("$"))
            {
                cost = cost.Replace("$", string.Empty);
            }
            newOuting.TotalCostForEvent = Convert.ToDouble(cost);

            _repo.AddOuting(newOuting);
        }
コード例 #5
0
        public void AddOutingTest()
        {
            //Arrange
            Outing newOuting = new Outing(EventType.Bowling, 5, new DateTime(2021, 4, 10), 50.00);

            //ACT
            bool wasAdded = _repo.AddOuting(newOuting);

            //ASSERT
            Assert.IsTrue(wasAdded);
        }