コード例 #1
0
 public void Setup()
 {
     _validator      = new ApprenticeshipStatusChangeCommandValidator();
     _exampleCommand = new PauseApprenticeshipCommand {
         AccountId = 1L, ApprenticeshipId = 444L
     };
 }
        public override void SetUp()
        {
            base.SetUp();


            ExampleValidRequest = new PauseApprenticeshipCommand
            {
                AccountId        = 111L,
                ApprenticeshipId = 444L,
                DateOfChange     = DateTime.Now.Date,
                UserName         = "******"
            };

            TestApprenticeship = new Apprenticeship
            {
                CommitmentId  = 123L,
                PaymentStatus = PaymentStatus.Active,
                StartDate     = DateTime.UtcNow.Date.AddMonths(6)
            };

            MockCurrentDateTime.SetupGet(x => x.Now).Returns(DateTime.UtcNow);

            MockApprenticeshipRespository
            .Setup(x => x.GetApprenticeship(It.Is <long>(y => y == ExampleValidRequest.ApprenticeshipId)))
            .ReturnsAsync(TestApprenticeship);

            MockApprenticeshipRespository
            .Setup(x => x.UpdateApprenticeshipStatus(TestApprenticeship.CommitmentId,
                                                     ExampleValidRequest.ApprenticeshipId,
                                                     PaymentStatus.Paused))
            .Returns(Task.FromResult(new object()));
        }