Example #1
0
 public EFGSKeyStoreService(IGatewayWebContextReader reader,
                            IKeyFilter filter,
                            ITemporaryExposureKeyRepository repository,
                            ILogger <EFGSKeyStoreService> logger,
                            IRiskCalculator riskCalculator,
                            IEpochConverter epochConverter,
                            IDaysSinceOnsetOfSymptomsDecoder daysSinceOnsetOfSymptomsDecoder)
 {
     _webContextReader  = reader;
     _keyFilter         = filter;
     _tempKeyRepository = repository;
     _logger            = logger;
     _riskCalculator    = riskCalculator;
     _epochConverter    = epochConverter;
     _daysSinceOnsetOfSymptomsDecoder = daysSinceOnsetOfSymptomsDecoder;
 }
 public EFGSKeyStoreService(IKeyFilter filter,
                            ITemporaryExposureKeyRepository repository,
                            ILogger <EFGSKeyStoreService> logger,
                            IRiskCalculator riskCalculator,
                            IEpochConverter epochConverter,
                            IDaysSinceOnsetOfSymptomsDecoder daysSinceOnsetOfSymptomsDecoder,
                            IAddTemporaryExposureKeyService addTemporaryExposureKeyService)
 {
     _addTemporaryExposureKeyService = addTemporaryExposureKeyService;
     _keyFilter         = filter;
     _tempKeyRepository = repository;
     _logger            = logger;
     _riskCalculator    = riskCalculator;
     _epochConverter    = epochConverter;
     _daysSinceOnsetOfSymptomsDecoder = daysSinceOnsetOfSymptomsDecoder;
 }
Example #3
0
        public void GivenExampleTest(IRiskCalculator riskCalculator)
        {
            var calculator = new ParallelNaiveSphereLatticeCalculator();
            var stations = calculator.FindLatticePoints(7).Select(x => new Station(x));
            var actual = riskCalculator.CalculateRisk(stations, 7).TotalRisk;

            Assert.AreEqual(0.1784943998, Math.Round(actual, 10));
        }
Example #4
0
        public void UnitCircleTest(IRiskCalculator calculator)
        {
            var unitCircle = new []
            {
                new CartesianCoordinates(0, 0, 1),
                new CartesianCoordinates(0, 1, 0),
                new CartesianCoordinates(1, 0, 0),
                new CartesianCoordinates(0, 0, -1),
                new CartesianCoordinates(0, -1, 0),
                new CartesianCoordinates(-1, 0, 0)
            };

            var stations = unitCircle.Select(coord => new Station(coord));

            var actual = calculator.CalculateRisk(stations, 1).TotalRisk;

            Assert.AreEqual(0.5, actual);
        }
 public RiskAssessment(IRiskCalculator riskCalculator)
 {
     RiskCalculator = riskCalculator;
 }