Example #1
0
 public void Can_Call_EnsureLoaded_Multiple_Times_Excluding_Private()
 => _testDomain.DoCallBack(() =>
 {
     DicomDictionary.EnsureDefaultDictionariesLoaded(false);
     DicomDictionary.EnsureDefaultDictionariesLoaded(false);
     DicomDictionary.EnsureDefaultDictionariesLoaded();
 });
 public void Throws_If_Already_Loaded()
 {
     _testDomain.DoCallBack(() =>
     {
         var dict = DicomDictionary.EnsureDefaultDictionariesLoaded(false);
         Assert.Throws <DicomDataException>(() => DicomDictionary.Default = new DicomDictionary());
     });
 }
 public void Throws_If_EnsureLoaded_Called_Without_And_With_Private()
 {
     _testDomain.DoCallBack(() =>
     {
         DicomDictionary.EnsureDefaultDictionariesLoaded(false);
         Assert.Throws <DicomDataException>(() => DicomDictionary.EnsureDefaultDictionariesLoaded(true));
     });
 }
Example #4
0
 public void EnsureLoaded_Assumes_Loading_Private_Dictionary_Data_By_Default()
 => _testDomain.DoCallBack(() =>
 {
     var dict            = DicomDictionary.EnsureDefaultDictionariesLoaded();
     var secondEnsurCall = DicomDictionary.EnsureDefaultDictionariesLoaded(loadPrivateDictionary: true);
     Assert.Equal(dict, secondEnsurCall);
     Assert.Throws <DicomDataException>(
         () => DicomDictionary.EnsureDefaultDictionariesLoaded(loadPrivateDictionary: false));
 });
Example #5
0
        public void GetEnumerator_ExecutionTime_IsNotSlow()
        {
            DicomDictionary.EnsureDefaultDictionariesLoaded();

            var millisecondsPerCall = TimeCall(100, () => Assert.NotNull(DicomDictionary.Default.Last()));

            var referenceTime = TimeCall(100, () => Assert.NotNull(Enumerable.Range(0, 1000).ToDictionary(i => 2 * i).Values.Last()));

            _output.WriteLine($"GetEnumerator: {millisecondsPerCall} ms per call, reference time: {referenceTime} ms per call");

            Assert.InRange(millisecondsPerCall, 0, (1 + referenceTime) * 5);
        }