public void Should_Not_Shift_Observation_EffectiveDate_Null()
        {
            var pepper = Guid.NewGuid();
            var obs = new ObservationDatasetRecord { Salt = Guid.NewGuid() };
            var anon = new Anonymizer<ObservationDatasetRecord>(pepper);

            anon.Anonymize(obs);

            Assert.Null(obs.EffectiveDate);
        }
        public void Should_Mask_Observation_PersonId_And_EncounterId()
        {
            var pepper = Guid.NewGuid();
            var obs = new ObservationDatasetRecord { Salt = Guid.NewGuid(), PersonId = "abc123", EncounterId = "def456" };
            var anon = new Anonymizer<ObservationDatasetRecord>(pepper);

            anon.Anonymize(obs);

            Assert.NotEqual("abc123", obs.PersonId);
            Assert.NotEqual("def456", obs.EncounterId);
        }
        public void Should_Shift_Observation_EffectiveDate_NotNull()
        {
            var pepper = Guid.NewGuid();
            var obs = new ObservationDatasetRecord { Salt = Guid.NewGuid(), EffectiveDate = new DateTime(2018, 12, 14, 10, 33, 00) };
            var anon = new Anonymizer<ObservationDatasetRecord>(pepper);

            anon.Anonymize(obs);

            Assert.NotNull(obs.EffectiveDate);
            Assert.NotEqual(new DateTime(2018, 12, 14, 10, 33, 00), obs.EffectiveDate);
            Assert.Equal(33, obs.EffectiveDate.Value.Minute);
        }
Exemple #4
0
        ObservationDatasetRecord GetRecord(SqlDataReader reader)
        {
            var rec = new ObservationDatasetRecord
            {
                Salt               = reader.GetGuid(Plan.Salt.Index),
                PersonId           = reader.GetNullableString(Plan.PersonId?.Index),
                Category           = reader.GetNullableString(Plan.Category?.Index),
                Code               = reader.GetNullableString(Plan.Code?.Index),
                EffectiveDate      = reader.GetNullableDateTime(Plan.EffectiveDate?.Index),
                EncounterId        = reader.GetNullableString(Plan.EncounterId?.Index),
                ReferenceRangeLow  = reader.GetNullableObject(Plan.ReferenceRangeLow?.Index),
                ReferenceRangeHigh = reader.GetNullableObject(Plan.ReferenceRangeHigh?.Index),
                SpecimenType       = reader.GetNullableString(Plan.SpecimenType?.Index),
                ValueString        = reader.GetNullableString(Plan.ValueString?.Index),
                ValueQuantity      = reader.GetNullableObject(Plan.ValueQuantity?.Index),
                ValueUnit          = reader.GetNullableString(Plan.ValueUnit?.Index)
            };

            return(rec);
        }