예제 #1
0
파일: OysterCard.cs 프로젝트: jplebre/Katas
 private void CheckZoneUsage(Journey journey)
 {
     if (_zoneUsed < journey.Zone)
     {
         DailyCostCap = Prices.DailyCapZoneB;
         _zoneUsed = Zone.B;
     }
 }
예제 #2
0
파일: OysterCard.cs 프로젝트: jplebre/Katas
        public void AddJourney(Journey journey)
        {
            if (JourneyList.Count >= 1)
                journey.CheckIsReturnJourney(JourneyList.Last());

            JourneyList.Add(journey);
            CheckZoneUsage(journey);

            CalculateDiscount();
        }
예제 #3
0
파일: Journey.cs 프로젝트: jplebre/Katas
        public void CheckIsReturnJourney(Journey previousJourney)
        {
            this.IsReturnJourney = (previousJourney.Destination == this.Origin && previousJourney.Origin == this.Destination);

            if (this.IsReturnJourney && !previousJourney.IsReturnJourney)
            {
                if (this.Zone == Zone.A) this.Cost = Prices.ReturnZoneA;
                else this.Cost = Prices.ReturnZoneB;
            }
        }
예제 #4
0
파일: Passenger.cs 프로젝트: jplebre/Katas
 public void PerformJourney(Journey journey)
 {
     OysterCard.AddJourney(journey);
 }