예제 #1
0
 public async Task <IEnumerable <Rule> > HandleAsync(GetRulesQuery query, CancellationToken ct)
 {
     return(await _rules.Select(r => new Rule
     {
         Id = r.ExternalId,
         Index = r.Index,
         Pattern = r.Pattern,
         SourceType = r.SourceType,
         DestinationType = r.DestinationType,
         GroupId = r.Group.ExternalId
     }).ToListAsync(ct));
 }
        public void Arrange()
        {
            _query             = new GetRulesQuery();
            _cancellationToken = new CancellationToken();
            _service           = new Mock <IRulesService>();
            _globalRuleService = new Mock <IGlobalRulesService>();
            _globalRules       = new List <GlobalRule>();
            _globalRuleService.Setup(x => x.GetAllRules())
            .ReturnsAsync(_globalRules);

            _rules = new List <ReservationRule>
            {
                new ReservationRule(new Rule {
                    Id = ExpectedReservationRuleId, Course = new Course()
                })
            };

            _handler = new GetRulesQueryHandler(_service.Object, _globalRuleService.Object);
        }