Esempio n. 1
0
            public UpdateChangeOfPartyRequestEventHandlerTestsFixture()
            {
                var autoFixture = new Fixture();

                _command = autoFixture.Build <CohortWithChangeOfPartyUpdatedEvent>()
                           .Create();

                _draftApprenticeship = new DraftApprenticeship
                {
                    StartDate = _startDate,
                    EndDate   = _endDate,
                    Cost      = _cost
                };

                _cohort = new Cohort
                {
                    Id = _command.CohortId,
                    Apprenticeships = new List <ApprenticeshipBase> {
                        _draftApprenticeship
                    },
                    ChangeOfPartyRequestId = 123,
                    WithParty = Party.Provider
                };

                _changeOfPartyRequest = new Mock <ChangeOfPartyRequest>();

                _mockDbContext = new Mock <ProviderCommitmentsDbContext>(new DbContextOptionsBuilder <ProviderCommitmentsDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options)
                {
                    CallBase = true
                };

                _mockDbContext.Object.Cohorts.Add(_cohort);
                _mockDbContext.Object.ChangeOfPartyRequests.Add(_changeOfPartyRequest.Object);
                _mockDbContext.Object.SaveChanges();

                _messageHandlerContext = new Mock <IMessageHandlerContext>();

                _handler = new CohortWithChangeOfPartyUpdatedEventHandler(new Lazy <ProviderCommitmentsDbContext>(() => _mockDbContext.Object));
            }
Esempio n. 2
0
        public Task PublishCohortWithChangeOfPartyUpdatedEvent(long cohortId, UserInfo userInfo)
        {
            var @event = new CohortWithChangeOfPartyUpdatedEvent(cohortId, userInfo);

            return(PublishWithLog(@event, $"Cohort with change of party request, CohortId:{cohortId}, updated"));
        }