Exemple #1
0
        public void Should_Return_Matched_Apprenticeships()
        {
            var apprenticeships = new List <ApprenticeshipModel>
            {
                new ApprenticeshipModel {
                    Ukprn = 12345, Uln = 1
                },
                new ApprenticeshipModel {
                    Ukprn = 12345, Uln = 2
                },
                new ApprenticeshipModel {
                    Ukprn = 12345, Uln = 3
                },
                new ApprenticeshipModel {
                    Ukprn = 123456, Uln = 4
                }
            };

            var ukprnMatcher = new UkprnMatcher();

            var result = ukprnMatcher.MatchUkprn(12345, apprenticeships);

            result.Should().NotBeNull();
            result.Apprenticeships.Count(a => a.Uln == 1).Should().Be(1);
            result.Apprenticeships.Count(a => a.Uln == 2).Should().Be(1);
            result.Apprenticeships.Count(a => a.Uln == 3).Should().Be(1);
            result.Apprenticeships.Count(a => a.Uln == 4).Should().Be(0);
        }
        public async Task ShouldReturnNullWhenCacheHasLearnerRecords()
        {
            dataLockLearnerCache = new Mock <IDataLockLearnerCache>();
            dataLockLearnerCache
            .Setup(o => o.UkprnExists(It.IsAny <long>()))
            .Returns(Task.FromResult(true));

            var ukprnMatcher = new UkprnMatcher(dataLockLearnerCache.Object);
            var result       = await ukprnMatcher.MatchUkprn(1234).ConfigureAwait(false);

            result.Should().BeNull();
        }
Exemple #3
0
        public void Should_Return_DataLock_01_When_No_Apprenticeships()
        {
            var apprenticeships = new List <ApprenticeshipModel>();

            var ukprnMatcher = new UkprnMatcher();

            var result = ukprnMatcher.MatchUkprn(12345, apprenticeships);

            result.Should().NotBeNull();
            result.DataLockErrorCode.Should().NotBeNull();
            result.DataLockErrorCode.Should().Be(DataLockErrorCode.DLOCK_01);
        }
        public async Task ShouldReturnDataLockOneWhenCacheIsEmpty()
        {
            dataLockLearnerCache = new Mock <IDataLockLearnerCache>();
            dataLockLearnerCache
            .Setup(o => o.UkprnExists(It.IsAny <long>()))
            .Returns(Task.FromResult(false));

            var ukprnMatcher = new UkprnMatcher(dataLockLearnerCache.Object);

            var result = await ukprnMatcher.MatchUkprn(12345).ConfigureAwait(false);

            result.Should().NotBeNull();
            result.Should().Be(DataLockErrorCode.DLOCK_01);
        }
Exemple #5
0
        public void Should_Not_Return_DataLock_01_When_Apprenticeships_Match_Ukprn()
        {
            var apprenticeships = new List <ApprenticeshipModel> {
                new ApprenticeshipModel {
                    Ukprn = 12345
                }
            };

            var ukprnMatcher = new UkprnMatcher();

            var result = ukprnMatcher.MatchUkprn(12345, apprenticeships);

            result.Should().NotBeNull();
            result.DataLockErrorCode.Should().BeNull();
        }