Ejemplo n.º 1
0
 public TimedArea(Polygon Area, long TurnStart, long TurnEnd, long Id, IncentiveType Type,
                  int playerId = -1, int strategyId = -1, string displayName = "")
     : base(TurnStart, TurnEnd, Id, playerId, Type, EventType.Area, strategyId)
 {
     this.Area   = Area;
     DisplayName = displayName;
 }
        public async Task Then_the_properties_are_set_correctly(int age, IncentiveType expectedIncentiveType, decimal expectedAmount1, int expectedDays1, decimal expectedAmount2, int expectedDays2)
        {
            var date = new DateTime(2020, 10, 1);

            var apprenticeshipIncentive = new ApprenticeshipIncentiveBuilder()
                                          .WithStartDate(date)
                                          .WithIncentivePhase(new IncentivePhase(Phase.Phase1))
                                          .WithApprenticeship(
                new ApprenticeshipBuilder()
                .WithDateOfBirth(date.AddYears(-1 * age))
                .Build())
                                          .Build();

            var result = await Incentive.Create(apprenticeshipIncentive, _mockIncentivePaymentProfileService.Object);

            result.IsEligible.Should().BeTrue();
            var payments = result.Payments.ToList();

            payments.Count().Should().Be(2);
            payments[0].Amount.Should().Be(expectedAmount1);
            payments[0].PaymentDate.Should().Be(date.AddDays(expectedDays1));
            payments[0].EarningType.Should().Be(EarningType.FirstPayment);
            payments[1].Amount.Should().Be(expectedAmount2);
            payments[1].PaymentDate.Should().Be(date.AddDays(expectedDays2));
            payments[1].EarningType.Should().Be(EarningType.SecondPayment);
        }
Ejemplo n.º 3
0
 public TimedEvent(long TurnStart, long TurnEnd, long Id, int PlayerId, IncentiveType type, EventType eventType, long StrategyId = -1)
 {
     this.TurnStart  = TurnStart;
     this.TurnEnd    = TurnEnd;
     this.Id         = Id;
     this.PlayerId   = PlayerId;
     Type            = type;
     this.EventType  = eventType;
     this.StrategyId = StrategyId;
 }
Ejemplo n.º 4
0
 public Transition(long id, int transitionId, int previousId, List <TransitionFrame> frames,
                   long turnStart, long turnEnd, int playerId, IncentiveType incentiveType, long strategyId,
                   float speed)
     : base(turnStart, turnEnd, id, playerId, incentiveType, EventType.Transition, strategyId)
 {
     PreviousTransitionId = previousId;
     TransitionId         = transitionId;
     Frames = frames;
     Speed  = speed;
 }
        public List <Vector> GetVectors(IncentiveType type)
        {
            List <Vector> vectors = new List <Vector>();

            foreach (TimedPosition position in GetAllPositions(type))
            {
                vectors.Add(position.Position);
            }
            return(vectors);
        }
        public PolygonList GetPolygons(IncentiveType type)
        {
            PolygonList polygons = new PolygonList();

            foreach (TimedArea area in GetAllAreas(type))
            {
                polygons.Add(area.Area);
            }
            return(polygons);
        }
Ejemplo n.º 7
0
        public Incentive(IncentiveType incentiveType, Attraction offerToAttraction, Attraction exchangeAtAttraction, int numberOfVisitorsToOffer)
        {
            this.IncentiveType           = incentiveType;
            this.OfferToAttraction       = offerToAttraction;
            this.ExchangeAtAttraction    = exchangeAtAttraction;
            this.NumberOfVisitorsToOffer = numberOfVisitorsToOffer;

            this.RetailValue = RetailPrices[incentiveType];
            this.RealValue   = RealPrices[incentiveType];
        }
Ejemplo n.º 8
0
 public virtual void OverrideWith(TimedEvent other)
 {
     TurnStart  = other.TurnStart;
     TurnEnd    = other.TurnEnd;
     Id         = other.Id;
     StrategyId = other.StrategyId;
     Type       = other.Type;
     EventType  = other.EventType;
     PlayerId   = other.PlayerId;
 }
 public IEnumerable <TimedPosition> GetAllPositions(IncentiveType type)
 {
     foreach (TimedEvent timedEvent in Events)
     {
         TimedPosition timedPosition = timedEvent as TimedPosition;
         if (timedPosition != null && (type == IncentiveType.All || timedPosition.Type == type))
         {
             yield return(timedPosition);
         }
     }
 }
 public IEnumerable <TimedArea> GetAllAreas(IncentiveType type)
 {
     foreach (TimedEvent timedEvent in Events)
     {
         TimedArea timedArea = timedEvent as TimedArea;
         if (timedArea != null && (type == IncentiveType.All || timedArea.Type == type))
         {
             yield return(timedArea);
         }
     }
 }
Ejemplo n.º 11
0
        public void Then_the_properties_are_set_correctly(int age, IncentiveType expectedIncentiveType, decimal expectedAmount1, int expectedDays1, decimal expectedAmount2, int expectedDays2)
        {
            var date = new DateTime(2020, 10, 1);

            var result = new Incentive(date.AddYears(-1 * age), date, _incentivePaymentProfiles);

            result.IncentiveType.Should().Be(expectedIncentiveType);
            result.IsEligible.Should().BeTrue();
            var payments = result.Payments.ToList();

            payments.Count.Should().Be(2);
            payments[0].Amount.Should().Be(expectedAmount1);
            payments[0].PaymentDate.Should().Be(date.AddDays(expectedDays1));
            payments[0].EarningType.Should().Be(EarningType.FirstPayment);
            payments[1].Amount.Should().Be(expectedAmount2);
            payments[1].PaymentDate.Should().Be(date.AddDays(expectedDays2));
            payments[1].EarningType.Should().Be(EarningType.SecondPayment);
        }
Ejemplo n.º 12
0
 public TimedPosition(Vector position, long turn, long id, IncentiveType type, int playerId, long strategyId = -1, string displayName = "")
     : base(turn, turn, id, playerId, type, EventType.Position, strategyId)
 {
     Position    = position;
     DisplayName = displayName;
 }
Ejemplo n.º 13
0
 public TransitionKeyframe(long turn, long id, int playerId, IncentiveType incentiveType, int strategyId)
     : base(turn, turn, id, playerId, incentiveType, EventType.Keyframe, strategyId)
 {
 }
Ejemplo n.º 14
0
 public PaymentProfile(IncentiveType incentiveType, int daysAfterApprenticeshipStart, decimal amountPayable)
 {
     DaysAfterApprenticeshipStart = daysAfterApprenticeshipStart;
     AmountPayable = amountPayable;
     IncentiveType = incentiveType;
 }
 public List <TimedEvent> GetEventsForTurnExpandingTransitions(long turn, EventType eventType, IncentiveType incentiveType)
 {
     return(GetEventsForTurnExpandingTransitions(turn, new[] { eventType }, new[] { incentiveType }));
 }
Ejemplo n.º 16
0
 public TimedArea(Polygon Area, long Turn, long Id, IncentiveType Type, int playerId = -1, int strategyId = -1)
     : base(Turn, Turn, Id, playerId, Type, EventType.Area, strategyId)
 {
     this.Area = Area;
 }
 public IncentivePaymentProfile(IncentiveType incentiveType, List <PaymentProfile> paymentProfiles)
 {
     IncentiveType   = incentiveType;
     PaymentProfiles = paymentProfiles;
 }