コード例 #1
0
        public void CloneIsDeep()
        {
            var metaData = new ImageMetadata
            {
                ExifProfile          = new ExifProfile(),
                HorizontalResolution = 4,
                VerticalResolution   = 2
            };

            ImageMetadata clone = metaData.DeepClone();

            clone.HorizontalResolution = 2;
            clone.VerticalResolution   = 4;

            Assert.False(metaData.ExifProfile.Equals(clone.ExifProfile));
            Assert.False(metaData.HorizontalResolution.Equals(clone.HorizontalResolution));
            Assert.False(metaData.VerticalResolution.Equals(clone.VerticalResolution));
        }
コード例 #2
0
        public void ConstructorImageMetaData()
        {
            var metaData = new ImageMetadata();

            var exifProfile   = new ExifProfile();
            var imageProperty = new ImageProperty("name", "value");

            metaData.ExifProfile          = exifProfile;
            metaData.HorizontalResolution = 4;
            metaData.VerticalResolution   = 2;
            metaData.Properties.Add(imageProperty);

            ImageMetadata clone = metaData.DeepClone();

            Assert.Equal(exifProfile.ToByteArray(), clone.ExifProfile.ToByteArray());
            Assert.Equal(4, clone.HorizontalResolution);
            Assert.Equal(2, clone.VerticalResolution);
            Assert.Equal(imageProperty, clone.Properties[0]);
        }
コード例 #3
0
        public void CloneIsDeep()
        {
            var metaData = new ImageMetadata();

            var exifProfile   = new ExifProfile();
            var imageProperty = new ImageProperty("name", "value");

            metaData.ExifProfile          = exifProfile;
            metaData.HorizontalResolution = 4;
            metaData.VerticalResolution   = 2;
            metaData.Properties.Add(imageProperty);

            ImageMetadata clone = metaData.DeepClone();

            clone.HorizontalResolution = 2;
            clone.VerticalResolution   = 4;

            Assert.False(metaData.ExifProfile.Equals(clone.ExifProfile));
            Assert.False(metaData.HorizontalResolution.Equals(clone.HorizontalResolution));
            Assert.False(metaData.VerticalResolution.Equals(clone.VerticalResolution));
            Assert.False(metaData.Properties.Equals(clone.Properties));
            Assert.False(metaData.GetFormatMetadata(GifFormat.Instance).Equals(clone.GetFormatMetadata(GifFormat.Instance)));
        }