public override int GetHashCode()
        {
            int hash = 1;

            if (HasKeyData)
            {
                hash ^= KeyData.GetHashCode();
            }
            if (HasTransmissionRiskLevel)
            {
                hash ^= TransmissionRiskLevel.GetHashCode();
            }
            if (HasRollingStartIntervalNumber)
            {
                hash ^= RollingStartIntervalNumber.GetHashCode();
            }
            if (HasRollingPeriod)
            {
                hash ^= RollingPeriod.GetHashCode();
            }
            if (HasReportType)
            {
                hash ^= ReportType.GetHashCode();
            }
            if (HasDaysSinceOnsetOfSymptoms)
            {
                hash ^= DaysSinceOnsetOfSymptoms.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public void RiskLevel(int day, TransmissionRiskLevel expected)
        {
            var calculation = new TransmissionRiskLevelCalculationMk2();
            var result      = calculation.Calculate(day);

            Assert.Equal(expected, result);
        }
        public override int GetHashCode()
        {
            var hash = 1;

            if (HasKeyData)
            {
                hash ^= KeyData.GetHashCode();
            }
            if (HasTransmissionRiskLevel)
            {
                hash ^= TransmissionRiskLevel.GetHashCode();
            }
            if (HasRollingStartIntervalNumber)
            {
                hash ^= RollingStartIntervalNumber.GetHashCode();
            }
            if (HasRollingPeriod)
            {
                hash ^= RollingPeriod.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }

            return(hash);
        }
        public void RiskLevel(int day, TransmissionRiskLevel expected)
        {
            var tek = new Tek {
                RollingStartNumber = new DateTime(2020, 1, day, 0, 0, 0, DateTimeKind.Utc).ToRollingStartNumber()
            };
            var calculation = new TransmissionRiskLevelCalculationV1();
            var result      = calculation.Calculate(tek.RollingStartNumber, _DateOfSystemsOnset);

            Assert.AreEqual(expected, result);
        }
 public override int GetHashCode() {
     int hash = 1;
     if (KeyData.Length != 0) hash ^= KeyData.GetHashCode();
     if (RollingStartIntervalNumber != 0) hash ^= RollingStartIntervalNumber.GetHashCode();
     if (RollingPeriod != 0) hash ^= RollingPeriod.GetHashCode();
     if (TransmissionRiskLevel != 0) hash ^= TransmissionRiskLevel.GetHashCode();
     hash ^= visitedCountries_.GetHashCode();
     if (Origin.Length != 0) hash ^= Origin.GetHashCode();
     if (ReportType != global::Iks.Protobuf.EfgsReportType.Unknown) hash ^= ReportType.GetHashCode();
     if (DaysSinceOnsetOfSymptoms != 0) hash ^= DaysSinceOnsetOfSymptoms.GetHashCode();
     if (_unknownFields != null) {
         hash ^= _unknownFields.GetHashCode();
     }
     return hash;
 }
Beispiel #6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (KeyData.Length != 0)
            {
                hash ^= KeyData.GetHashCode();
            }
            if (RollingStartIntervalNumber != 0)
            {
                hash ^= RollingStartIntervalNumber.GetHashCode();
            }
            if (RollingPeriod != 0)
            {
                hash ^= RollingPeriod.GetHashCode();
            }
            if (TransmissionRiskLevel != 0)
            {
                hash ^= TransmissionRiskLevel.GetHashCode();
            }
            hash ^= visitedCountries_.GetHashCode();
            if (Origin.Length != 0)
            {
                hash ^= Origin.GetHashCode();
            }
            if (ReportType != global::FederationGatewayApi.Models.Proto.TemporaryExposureKeyGatewayDto.Types.ReportType.Unknown)
            {
                hash ^= ReportType.GetHashCode();
            }
            if (DaysSinceOnsetOfSymptoms != 0)
            {
                hash ^= DaysSinceOnsetOfSymptoms.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #7
0
 private static DiagnosisKeyEntity CreateDk(byte[] keyData, int rsn, int rp, bool publishedLocally, DateTime?created = null, TransmissionRiskLevel trl = TransmissionRiskLevel.Low)
 {
     return(new DiagnosisKeyEntity
     {
         DailyKey = new DailyKey
         {
             KeyData = keyData,
             RollingPeriod = rp,
             RollingStartNumber = rsn
         },
         PublishedToEfgs = true,
         PublishedLocally = publishedLocally,
         Local = new LocalTekInfo
         {
             TransmissionRiskLevel = trl
         },
         Created = created ?? DateTime.Now
     });
 }