Ejemplo n.º 1
0
        public void Arrange()
        {
            _clientApi = new Mock <IProviderCommitmentsApi>();
            _clientApi.Setup(x => x.GetPendingApprenticeshipUpdate(It.IsAny <long>(), It.IsAny <long>()))
            .ReturnsAsync(new ApprenticeshipUpdate());

            _handler = new GetPendingApprenticeshipUpdateQueryHandler(_clientApi.Object);
        }
        public void Arrange()
        {
            _validator = new Mock <GetPendingApprenticeshipUpdateValidator>();
            _validator.Setup(x => x.Validate(It.IsAny <GetPendingApprenticeshipUpdateRequest>()))
            .Returns(() => new ValidationResult());

            var testApprenticeship = new Apprenticeship
            {
                Id = 999,
                EmployerAccountId = 888,
                ProviderId        = 777
            };

            _testRecord = new ApprenticeshipUpdate
            {
                Id = 1,
                ApprenticeshipId = 1,
                Originator       = Originator.Employer,
                FirstName        = "John",
                LastName         = "Smith",
                DateOfBirth      = new DateTime(2000, 01, 03),
                TrainingType     = TrainingType.Framework,
                TrainingCode     = "AB-123",
                TrainingName     = "Test Course",
                Cost             = 1000,
                StartDate        = new DateTime(2018, 1, 1),
                EndDate          = new DateTime(2018, 6, 1)
            };

            _apprenticeshipRepository = new Mock <IApprenticeshipRepository>();
            _apprenticeshipRepository.Setup(x => x.GetApprenticeship(It.IsAny <long>()))
            .ReturnsAsync(testApprenticeship);

            _apprenticeshipUpdateRepository = new Mock <IApprenticeshipUpdateRepository>();
            _apprenticeshipUpdateRepository.Setup(x => x.GetPendingApprenticeshipUpdate(It.IsAny <long>()))
            .ReturnsAsync(_testRecord);

            _handler = new GetPendingApprenticeshipUpdateQueryHandler(_validator.Object, _apprenticeshipUpdateRepository.Object, _apprenticeshipRepository.Object);
        }