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)); }); }
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)); });
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); }