public void SetUp()
        {
            _validator            = new ApproveTransferRequestValidator();
            _commitmentRepository = new Mock <ICommitmentRepository>();
            _v2EventsPublisher    = new Mock <IV2EventsPublisher>();

            var fixture = new Fixture();

            _command    = fixture.Build <ApproveTransferRequestCommand>().Create();
            _commitment = fixture.Build <Commitment>()
                          .With(x => x.TransferSenderId, _command.TransferSenderId)
                          .With(x => x.EmployerAccountId, _command.TransferReceiverId)
                          .With(x => x.TransferApprovalStatus, TransferApprovalStatus.Pending)
                          .With(x => x.EditStatus, EditStatus.Both).Create();

            _commitmentRepository.Setup(x => x.GetCommitmentById(It.IsAny <long>())).ReturnsAsync(_commitment);
            _commitment.Apprenticeships.ForEach(x => x.AgreementStatus = AgreementStatus.ProviderAgreed);

            _sut = new ApproveTransferRequestCommandHandler(_validator, _commitmentRepository.Object, _v2EventsPublisher.Object);
        }
        public ApproveTransferRequestCommandHandlerTestsFixture()
        {
            UnitOfWorkContext     = new UnitOfWorkContext();
            MessageHandlerContext = new Mock <IMessageHandlerContext>();
            Fixture = new Fixture();
            Now     = DateTime.UtcNow;

            Db = new ProviderCommitmentsDbContext(new DbContextOptionsBuilder <ProviderCommitmentsDbContext>()
                                                  .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                                  .ConfigureWarnings(w => w.Throw(RelationalEventId.QueryClientEvaluationWarning))
                                                  .Options);
            Logger = new FakeLogger <ApproveTransferRequestCommandHandler>();
            Sut    = new ApproveTransferRequestCommandHandler(new Lazy <ProviderCommitmentsDbContext>(() => Db), Logger);

            Cohort = new Cohort(
                Fixture.Create <long>(),
                Fixture.Create <long>(),
                Fixture.Create <long>(),
                null,
                Party.Employer,
                "",
                new UserInfo())
            {
                EmployerAccountId = 100, TransferSenderId = 99
            };

            ExistingApprenticeshipDetails = new DraftApprenticeship(Fixture.Build <DraftApprenticeshipDetails>().Create(), Party.Provider);
            Cohort.Apprenticeships.Add(ExistingApprenticeshipDetails);

            Cohort.EditStatus             = EditStatus.Both;
            Cohort.TransferApprovalStatus = TransferApprovalStatus.Pending;
            Cohort.TransferSenderId       = 10900;

            TransferSenderUserInfo = Fixture.Create <UserInfo>();
            TransferRequest        = new TransferRequest
            {
                Status = TransferApprovalStatus.Pending, Cost = 1000, Cohort = Cohort
            };
        }