GetProgressAndValidateCommonInputsForStoreAspProgressEndpoints_returns_StoreAspProgressException_if_a_query_param_is_null(
            int?progressId,
            int?version,
            int?tutorialId,
            int?delegateId,
            int?customisationId
            )
        {
            // When
            var result = storeAspService.GetProgressAndValidateCommonInputsForStoreAspProgressEndpoints(
                progressId,
                version,
                tutorialId,
                1,
                1,
                delegateId,
                customisationId
                );

            // Then
            using (new AssertionScope())
            {
                result.validationResponse.Should().Be(TrackerEndpointResponse.StoreAspProgressException);
                result.progress.Should().BeNull();
                A.CallTo(() => progressService.GetDetailedCourseProgress(A <int> ._)).MustNotHaveHappened();
            }
        }
Exemple #2
0
        public TrackerEndpointResponse StoreAspProgressV2(
            int?progressId,
            int?version,
            string?progressText,
            int?tutorialId,
            int?tutorialTime,
            int?tutorialStatus,
            int?candidateId,
            int?customisationId
            )
        {
            var(validationResponse, progress) =
                storeAspService.GetProgressAndValidateCommonInputsForStoreAspProgressEndpoints(
                    progressId,
                    version,
                    tutorialId,
                    tutorialTime,
                    tutorialStatus,
                    candidateId,
                    customisationId
                    );

            if (validationResponse != null)
            {
                return(validationResponse);
            }

            try
            {
                storeAspService.StoreAspProgressAndSendEmailIfComplete(
                    progress !,
                    version !.Value,
                    progressText,
                    tutorialId !.Value,
                    tutorialTime !.Value,
                    tutorialStatus !.Value
                    );
            }
            catch (Exception ex)
            {
                logger.LogError(ex, ex.Message);
                return(TrackerEndpointResponse.StoreAspProgressException);
            }

            return(TrackerEndpointResponse.Success);
        }
        public void StoreAspProgressV2_returns_exception_from_validation()
        {
            // Given
            A.CallTo(
                () => storeAspService.GetProgressAndValidateCommonInputsForStoreAspProgressEndpoints(
                    A <int?> ._,
                    A <int?> ._,
                    A <int?> ._,
                    A <int?> ._,
                    A <int?> ._,
                    A <int?> ._,
                    A <int?> ._
                    )
                ).Returns((TrackerEndpointResponse.StoreAspProgressException, null));

            // When
            var result = trackerActionService.StoreAspProgressV2(
                DefaultProgressId,
                DefaultCustomisationVersion,
                DefaultLmGvSectionRow,
                DefaultTutorialId,
                DefaultTutorialTime,
                DefaultTutorialStatus,
                DefaultDelegateId,
                DefaultCustomisationId
                );

            // Then
            result.Should().Be(TrackerEndpointResponse.StoreAspProgressException);
            A.CallTo(
                () => storeAspService.StoreAspProgressAndSendEmailIfComplete(
                    A <DetailedCourseProgress> ._,
                    A <int> ._,
                    A <string?> ._,
                    A <int> ._,
                    A <int> ._,
                    A <int> ._
                    )
                ).MustNotHaveHappened();
        }