public void TestAppendValueConvertToStream()
        {
            var testSize = DicomAttributeBinaryData <T> .TestStreamThresholdInValues;
            var array0   = GenerateValues(testSize);
            var data0    = new DicomAttributeBinaryData <T>(array0, true);

            Assert.IsNotNull(data0.TestGetArray(), "array before switch");
            Assert.IsNull(data0.TestGetStream(), "stream before switch");

            data0.AppendValue(default(T));

            Assert.IsNull(data0.TestGetArray(), "array after switch");
            Assert.IsNotNull(data0.TestGetStream(), "stream after switch");
        }
        public void TestConstructorArray()
        {
            var array0 = GenerateValues(100);
            var data0  = new DicomAttributeBinaryData <T>(array0, false);

            Assert.AreSame(array0, data0.TestGetArray(), "no copy");

            data0 = new DicomAttributeBinaryData <T>(array0, true);
            Assert.AreNotSame(array0, data0.TestGetArray(), "copy (reference)");
            Assert.AreEqual(array0, data0.TestGetArray(), "copy (contents)");

            array0 = GenerateValues(DicomAttributeBinaryData <T> .TestStreamThresholdInValues + 1);
            data0  = new DicomAttributeBinaryData <T>(array0, true);
            Assert.IsNull(data0.TestGetArray(), "copy to stream (array)");
            Assert.AreEqual(array0, ConvertToTArray(data0.TestGetStream().ToArray()), "copy to stream (contents)");
        }
        public void TestConstructorCopy()
        {
            var array0 = GenerateValues(100);
            var data0  = new DicomAttributeBinaryData <T>(array0, true);

            var data1 = new DicomAttributeBinaryData <T>(data0);

            Assert.AreEqual(array0, data1.TestGetArray(), "arrays");
        }
        public void TestConstructor()
        {
            Assert.AreEqual(0, new DicomAttributeBinaryData <T>().Count, ".ctor(0)");
            Assert.AreEqual(10, new DicomAttributeBinaryData <T>(10).Count, ".ctor(10)");

            var d = new DicomAttributeBinaryData <T>(DicomAttributeBinaryData <T> .TestStreamThresholdInValues);

            Assert.IsNotNull(d.TestGetArray(), "array in .ctor(threshold)");
            Assert.IsNull(d.TestGetStream(), "stream in .ctor(threshold)");

            d = new DicomAttributeBinaryData <T>(DicomAttributeBinaryData <T> .TestStreamThresholdInValues + 1);
            Assert.IsNull(d.TestGetArray(), "array in .ctor(threshold+1)");
            Assert.IsNotNull(d.TestGetStream(), "stream in .ctor(threshold+1)");
        }