public void UpdateDraftApprenticeship_WithInvalidInput_ShouldThrowException()
        {
            var fixtures = new CohortTestFixtures();

            // arrange
            var originalDraft        = fixtures.Create();
            var modifiedDraft        = fixtures.UpdatePropertiesWithNewValues(originalDraft);
            var modifiedDraftDetails = fixtures.ToApprenticeshipDetails(modifiedDraft, Party.Provider);

            modifiedDraftDetails.StartDate = modifiedDraftDetails.EndDate.Value.AddMonths(1);

            var c = new CommitmentsV2.Models.Cohort {
                WithParty = Party.Provider, ProviderId = 1
            };

            c.Apprenticeships.Add(originalDraft);

            // Act
            Assert.Throws <DomainException>(() => c.UpdateDraftApprenticeship(modifiedDraftDetails, Party.Provider, fixtures.UserInfo));
        }
        public void UpdateDraftApprenticeship_WithValidInput_ShouldUpdateExistingDraftApprenticeship()
        {
            var fixtures = new CohortTestFixtures();

            // arrange
            var originalDraft        = fixtures.Create();
            var modifiedDraft        = fixtures.UpdatePropertiesWithNewValues(originalDraft);
            var modifiedDraftDetails = fixtures.ToApprenticeshipDetails(modifiedDraft, Party.Provider);

            var c = new CommitmentsV2.Models.Cohort {
                WithParty = Party.Provider, ProviderId = 1
            };

            c.Apprenticeships.Add(originalDraft);

            // Act
            c.UpdateDraftApprenticeship(modifiedDraftDetails, Party.Provider, fixtures.UserInfo);

            // Assert
            var savedDraft = c.DraftApprenticeships.Single(a => a.Id == modifiedDraft.Id);

            fixtures.AssertSameProperties(modifiedDraft, savedDraft);
        }