Exemplo n.º 1
0
        private AddTemporaryExposureKeyService CreateTestObject()
        {
            _temporaryExposureKeyRepositoryMock.Setup(x => x.GetNextBatchOfKeysWithRollingStartNumberThresholdAsync(It.IsAny <long>(), It.IsAny <int>(), It.IsAny <int>())).ReturnsAsync(new List <TemporaryExposureKey>());
            _temporaryExposureKeyRepositoryMock.Setup(x => x.GetNextBatchOfKeysWithRollingStartNumberThresholdAsync(It.IsAny <long>(), 0, It.IsAny <int>())).ReturnsAsync(new List <TemporaryExposureKey>()
            {
                new TemporaryExposureKey()
            });
            var countryRepositoryMock = new Mock <ICountryRepository>();

            countryRepositoryMock.Setup(
                m => m.FindByIsoCode(It.IsAny <string>()))
            .Returns(new Country()
            {
                Code = "DK"     // shouldn't this be no?
            });

            var temporaryExposureKeyCountryRepositoryMock = new Mock <IGenericRepository <TemporaryExposureKeyCountry> >();
            var exposureKeyMapperMock = new Mock <IExposureKeyMapper>();

            exposureKeyMapperMock.Setup(x => x.FromDtoToEntity(It.IsAny <TemporaryExposureKeyBatchDto>())).Returns(_exampleKeyList);

            var addTemporaryExposureKeyService = new AddTemporaryExposureKeyService(
                countryRepositoryMock.Object,
                temporaryExposureKeyCountryRepositoryMock.Object,
                exposureKeyMapperMock.Object,
                _temporaryExposureKeyRepositoryMock.Object,
                _logger.Object);

            return(addTemporaryExposureKeyService);
        }
        public AddTemporaryExposureKeyService CreateTestObject()
        {
            _temporaryExposureKeyRepositoryMock.Setup(x => x.GetNextBatchOfKeysWithRollingStartNumberThresholdAsync(It.IsAny <long>(), It.IsAny <int>(), It.IsAny <int>())).ReturnsAsync(new List <TemporaryExposureKey>());
            _temporaryExposureKeyRepositoryMock.Setup(x => x.GetNextBatchOfKeysWithRollingStartNumberThresholdAsync(It.IsAny <long>(), 0, It.IsAny <int>())).ReturnsAsync(new List <TemporaryExposureKey>()
            {
                new TemporaryExposureKey()
            });
            var countryRepositoryMock = new Mock <ICountryRepository>();

            countryRepositoryMock.Setup(
                m => m.FindByIsoCode(It.IsAny <string>()))
            .Returns(new Country()
            {
                Code = "DK"
            });

            var temporaryExposureKeyCountryRepositoryMock = new Mock <IGenericRepository <TemporaryExposureKeyCountry> >();
            var exposureKeyMapperMock = new Mock <IExposureKeyMapper>();

            exposureKeyMapperMock.Setup(x => x.FromDtoToEntity(It.IsAny <TemporaryExposureKeyBatchDto>())).Returns(_exampleKeyList);

            var config = new AppSettingsConfig()
            {
                MaxKeysPerFile = 750000
            };

            var addTemporaryExposureKeyService = new AddTemporaryExposureKeyService(
                countryRepositoryMock.Object,
                temporaryExposureKeyCountryRepositoryMock.Object,
                exposureKeyMapperMock.Object,
                _temporaryExposureKeyRepositoryMock.Object, config);

            return(addTemporaryExposureKeyService);
        }