Esempio n. 1
0
        public void Arrange()
        {
            var fixture = new Fixture();

            var birthDate = fixture.Create <DateTime?>();
            var startDate = fixture.Create <DateTime?>();
            var endDate   = fixture.Create <DateTime?>();

            _getDraftApprenticeshipResponse = fixture.Create <GetDraftApprenticeshipResponse>();

            _mockCommitmentsApiClient = new Mock <ICommitmentsApiClient>();

            _mapper = new UpdateDraftApprenticeshipRequestMapper(_mockCommitmentsApiClient.Object);

            _source = fixture.Build <EditDraftApprenticeshipViewModel>()
                      .With(x => x.CourseCode, fixture.Create <int>().ToString())
                      .With(x => x.BirthDay, birthDate?.Day)
                      .With(x => x.BirthMonth, birthDate?.Month)
                      .With(x => x.BirthYear, birthDate?.Year)
                      .With(x => x.EndMonth, endDate?.Month)
                      .With(x => x.EndYear, endDate?.Year)
                      .With(x => x.StartMonth, startDate?.Month)
                      .With(x => x.StartYear, startDate?.Year)
                      .Without(x => x.StartDate)
                      .Without(x => x.Courses)
                      .Create();

            _mockCommitmentsApiClient.Setup(x => x.GetDraftApprenticeship(_source.CohortId.Value, _source.DraftApprenticeshipId, It.IsAny <CancellationToken>()))
            .ReturnsAsync(_getDraftApprenticeshipResponse);

            _act = async() => await _mapper.Map(TestHelper.Clone(_source));
        }
        public void Arrange()
        {
            var fixture = new Fixture();

            var birthDate = fixture.Create <DateTime?>();
            var startDate = fixture.Create <DateTime?>();
            var endDate   = fixture.Create <DateTime?>();

            _mapper = new UpdateDraftApprenticeshipRequestMapper();

            _source = fixture.Build <EditDraftApprenticeshipViewModel>()
                      .With(x => x.BirthDay, birthDate?.Day)
                      .With(x => x.BirthMonth, birthDate?.Month)
                      .With(x => x.BirthYear, birthDate?.Year)
                      .With(x => x.EndMonth, endDate?.Month)
                      .With(x => x.EndYear, endDate?.Year)
                      .With(x => x.StartMonth, startDate?.Month)
                      .With(x => x.StartYear, startDate?.Year)
                      .Without(x => x.StartDate)
                      .Without(x => x.Courses)
                      .Create();

            _act = async() => await _mapper.Map(TestHelper.Clone(_source));
        }