<commit_before>﻿// Copyright 2013-2019 <NAME> <https://github.com/dlemstra/Magick.NET/>
//
// Licensed under the ImageMagick License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
//
//   https://www.imagemagick.org/script/license.php
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.

using System;
using ImageMagick;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Magick.NET.Tests
{
    public partial class ExifValueTests
    {
        [TestClass]
        public class TheValueProperty
        {
            [TestMethod]
            public void ShouldThrowExceptionWhenValueIsInvalidDataType1()
            {
                var profile = new ExifProfile();
                profile.SetValue(ExifTagValue.Software, "Magick.NET");

                var value = profile.GetValue(ExifTagValue.Software);

                var exception = ExceptionAssert.Throws<InvalidOperationException>(() =>
                {
                    value.SetValue(10.5);
                });

                Assert.AreEqual("The type of the value should be String.", exception.Message);
            }

            [TestMethod]
            public void ShouldThrowExceptionWhenValueIsInvalidDataType2()
            {
                var profile = new ExifProfile();
                profile.SetValue(ExifTagValue.ShutterSpeedValue, new SignedRational(75.55));

                var value = profile.GetValue(ExifTagValue.ShutterSpeedValue);

                var exception = ExceptionAssert.Throws<InvalidOperationException>(() =>
                {
                    value.SetValue(75);
                });

                Assert.AreEqual("The type of the value should be SignedRational.", exception.Message);
            }

            [TestMethod]
            public void ShouldThrowExceptionWhenValueIsInvalidDataType3()
            {
                var profile = new ExifProfile();
                profile.SetValue(ExifTagValue.XResolution, new Rational(150.0));

                var value = profile.GetValue(ExifTagValue.XResolution);
                Assert.IsNotNull(value);
                Assert.AreEqual("150", value.ToString());

                var exception = ExceptionAssert.Throws<InvalidOperationException>(() =>
                {
                    value.SetValue("Magick.NET");
                });

                Assert.AreEqual("The type of the value should be Rational.", exception.Message);
            }
        }
    }
}
<commit_msg>Fixed unit tests due to changes.<commit_after>﻿// Copyright 2013-2019 <NAME> <https://github.com/dlemstra/Magick.NET/>
//
// Licensed under the ImageMagick License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
//
//   https://www.imagemagick.org/script/license.php
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.

using System;
using ImageMagick;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Magick.NET.Tests
{
    public partial class ExifValueTests
    {
        [TestClass]
        public class TheValueProperty
        {
            [TestMethod]
            public void ShouldReturnFalseWhenValueIsInvalidDataType1()
            {
                var profile = new ExifProfile();
                profile.SetValue(ExifTagValue.Software, "Magick.NET");

                IExifValue value = profile.GetValue(ExifTagValue.Software);

                Assert.IsFalse(value.SetValue(10.5));
            }

            [TestMethod]
            public void ShouldReturnFalseWhenValueIsInvalidDataType2()
            {
                var profile = new ExifProfile();
                profile.SetValue(ExifTagValue.ShutterSpeedValue, new SignedRational(75.55));

                IExifValue value = profile.GetValue(ExifTagValue.ShutterSpeedValue);

                Assert.IsFalse(value.SetValue(75));
            }

            [TestMethod]
            public void ShouldReturnFalseWhenValueIsInvalidDataType3()
            {
                var profile = new ExifProfile();
                profile.SetValue(ExifTagValue.XResolution, new Rational(150.0));

                IExifValue value = profile.GetValue(ExifTagValue.XResolution);
                Assert.IsNotNull(value);
                Assert.AreEqual("150", value.ToString());

                Assert.IsFalse(value.SetValue("Magick.NET"));
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.0877228119367114, 'fraction_numerical': 0.010815141197676747, 'mean_word_length': 2.1115264797507787, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3876944', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1206, 'n_words': 329}