Beispiel #1
0
        public void OutingRepository_GetOutingCostByType_ShouldReturnCostByType()
        {
            //Arrange
            Outings outings = new Outings();

            outings.TypeOfEvent    = EventType.Golf;
            outings.TotalCostEvent = 500m;
            _outingsRepository.AddOutingsToList(outings);

            Outings outingsTwo = new Outings();

            outingsTwo.TypeOfEvent    = EventType.Bowling;
            outingsTwo.TotalCostEvent = 250m;
            _outingsRepository.AddOutingsToList(outingsTwo);

            Outings outingsThree = new Outings();

            outingsThree.TypeOfEvent    = EventType.Golf;
            outingsThree.TotalCostEvent = 550m;
            _outingsRepository.AddOutingsToList(outingsThree);

            //Act
            decimal actual   = _outingsRepository.GetOutingsCostByType(EventType.Golf);
            decimal expected = 1050m;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void OutingsRepository_GetOutingsCostByType_ShouldReturnCorrectAmount()
        {
            _outingsRepo.GetOutingsList();

            //Arrange
            Outings ConcertOutingOne = new Outings();            //you are basically creating a new object with values to test

            ConcertOutingOne.TypeOfEvent    = EventType.Concert; //property on left, enum value on right
            ConcertOutingOne.TotalEventCost = 100;
            _outingsRepo.AddOutingsToList(ConcertOutingOne);

            Outings ConcertOutingTwo = new Outings();

            ConcertOutingTwo.TypeOfEvent    = EventType.Concert; //property on left, enum value on right
            ConcertOutingTwo.TotalEventCost = 200;
            _outingsRepo.AddOutingsToList(ConcertOutingTwo);

            //Act
            double actual   = _outingsRepo.GetOutingsCostByType(EventType.Concert);
            double expected = 300;

            //Assert
            Assert.AreEqual(expected, actual);
        }