Ejemplo n.º 1
0
 public CohortFullyApprovedEventHandlerTestsFixture()
 {
     AutoFixture = new Fixture();
     Mediator    = new Mock <IMediator>();
     Handler     = new CohortFullyApprovedEventHandler(Mediator.Object);
     Event       = AutoFixture.Create <CohortFullyApprovedEvent>();
 }
            public CohortFullyApprovedEventHandlerForEmailNotificationsTestsFixture()
            {
                _autoFixture = new Fixture();

                _messageHandlerContext = new Mock <IMessageHandlerContext>();
                _pipelineContext       = _messageHandlerContext.As <IPipelineContext>();

                _cohortReference          = _autoFixture.Create <string>();
                _employerEncodedAccountId = _autoFixture.Create <string>();
                _encodingService          = new Mock <IEncodingService>();
                _encodingService.Setup(x => x.Encode(It.Is <long>(id => id == _cohortSummary.CohortId),
                                                     EncodingType.CohortReference)).Returns(_cohortReference);
                _encodingService.Setup(x => x.Encode(It.Is <long>(id => id == _cohortSummary.AccountId),
                                                     EncodingType.AccountId)).Returns(_employerEncodedAccountId);

                _mediator = new Mock <IMediator>();
                _mediator.Setup(x => x.Send(It.IsAny <AddTransferRequestCommand>(), It.IsAny <CancellationToken>()))
                .ReturnsAsync(new Unit());

                _cohortSummary = _autoFixture.Create <GetCohortSummaryQueryResult>();
                _mediator.Setup(x => x.Send(It.IsAny <GetCohortSummaryQuery>(),
                                            It.IsAny <CancellationToken>()))
                .ReturnsAsync(_cohortSummary);

                _handler = new CohortFullyApprovedEventHandlerForEmailNotifications(_mediator.Object, _encodingService.Object);

                _event = new CohortFullyApprovedEvent(_autoFixture.Create <long>(),
                                                      _autoFixture.Create <long>(),
                                                      _autoFixture.Create <long>(),
                                                      _autoFixture.Create <DateTime>(),
                                                      _autoFixture.Create <Party>(),
                                                      _autoFixture.Create <long?>(),
                                                      _autoFixture.Create <UserInfo>()
                                                      );
            }
            public CohortFullyApprovedEventHandlerForEmailNotificationsTestsFixture WithLastApprovalParty(
                Party lastApprovalParty)
            {
                _event = new CohortFullyApprovedEvent(_autoFixture.Create <long>(),
                                                      _autoFixture.Create <long>(),
                                                      _autoFixture.Create <long>(),
                                                      _autoFixture.Create <DateTime>(),
                                                      lastApprovalParty, _autoFixture.Create <long?>(), _autoFixture.Create <UserInfo>());

                return(this);
            }