<commit_before>﻿namespace TraktApiSharp.Tests.Enums
{
    using FluentAssertions;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using TraktApiSharp.Enums;

    [TestClass]
    public class TraktReleaseTypeTests
    {
        [TestMethod]
        public void TestTraktReleaseTypeHasMembers()
        {
            typeof(TraktReleaseType).GetEnumNames().Should().HaveCount(7)
                                                   .And.Contain("Unknown", "Premiere", "Limited", "Theatrical", "Digital", "Physical", "Tv");
        }

        [TestMethod]
        public void TestTraktReleaseTypeGetAsString()
        {
            TraktReleaseType.Unknown.AsString().Should().Be("unknown");
            TraktReleaseType.Premiere.AsString().Should().Be("premiere");
            TraktReleaseType.Limited.AsString().Should().Be("limited");
            TraktReleaseType.Theatrical.AsString().Should().Be("theatrical");
            TraktReleaseType.Digital.AsString().Should().Be("digital");
            TraktReleaseType.Physical.AsString().Should().Be("physical");
            TraktReleaseType.Tv.AsString().Should().Be("tv");
        }
    }<commit_msg>Add unit tests for enum release type read and write.<commit_after>﻿namespace TraktApiSharp.Tests.Enums
{
    using FluentAssertions;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Newtonsoft.Json;
    using TraktApiSharp.Enums;

    [TestClass]
    public class TraktReleaseTypeTests
    {
        class TestObject
        {
            [JsonConverter(typeof(TraktReleaseTypeConverter))]
            public TraktReleaseType Value { get; set; }
        }

        [TestMethod]
        public void TestTraktReleaseTypeHasMembers()
        {
            typeof(TraktReleaseType).GetEnumNames().Should().HaveCount(7)
                                                   .And.Contain("Unknown", "Premiere", "Limited", "Theatrical", "Digital", "Physical", "Tv");
        }

        [TestMethod]
        public void TestTraktReleaseTypeGetAsString()
        {
            TraktReleaseType.Unknown.AsString().Should().Be("unknown");
            TraktReleaseType.Premiere.AsString().Should().Be("premiere");
            TraktReleaseType.Limited.AsString().Should().Be("limited");
            TraktReleaseType.Theatrical.AsString().Should().Be("theatrical");
            TraktReleaseType.Digital.AsString().Should().Be("digital");
            TraktReleaseType.Physical.AsString().Should().Be("physical");
            TraktReleaseType.Tv.AsString().Should().Be("tv");
        }

        [TestMethod]
        public void TestTraktReleaseTypeWriteAndReadJson_Premiere()
        {
            var obj = new TestObject { Value = TraktReleaseType.Premiere };

            var objWritten = JsonConvert.SerializeObject(obj);
            objWritten.Should().NotBeNullOrEmpty();

            var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten);
            objRead.Should().NotBeNull();
            objRead.Value.Should().Be(TraktReleaseType.Premiere);
        }

        [TestMethod]
        public void TestTraktReleaseTypeWriteAndReadJson_Limited()
        {
            var obj = new TestObject { Value = TraktReleaseType.Limited };

            var objWritten = JsonConvert.SerializeObject(obj);
            objWritten.Should().NotBeNullOrEmpty();

            var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten);
            objRead.Should().NotBeNull();
            objRead.Value.Should().Be(TraktReleaseType.Limited);
        }

        [TestMethod]
        public void TestTraktReleaseTypeWriteAndReadJson_Theatrical()
        {
            var obj = new TestObject { Value = TraktReleaseType.Theatrical };

            var objWritten = JsonConvert.SerializeObject(obj);
            objWritten.Should().NotBeNullOrEmpty();

            var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten);
            objRead.Should().NotBeNull();
            objRead.Value.Should().Be(TraktReleaseType.Theatrical);
        }

        [TestMethod]
        public void TestTraktReleaseTypeWriteAndReadJson_Digital()
        {
            var obj = new TestObject { Value = TraktReleaseType.Digital };

            var objWritten = JsonConvert.SerializeObject(obj);
            objWritten.Should().NotBeNullOrEmpty();

            var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten);
            objRead.Should().NotBeNull();
            objRead.Value.Should().Be(TraktReleaseType.Digital);
        }

        [TestMethod]
        public void TestTraktReleaseTypeWriteAndReadJson_Physical()
        {
            var obj = new TestObject { Value = TraktReleaseType.Physical };

            var objWritten = JsonConvert.SerializeObject(obj);
            objWritten.Should().NotBeNullOrEmpty();

            var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten);
            objRead.Should().NotBeNull();
            objRead.Value.Should().Be(TraktReleaseType.Physical);
        }

        [TestMethod]
        public void TestTraktReleaseTypeWriteAndReadJson_Tv()
        {
            var obj = new TestObject { Value = TraktReleaseType.Tv };

            var objWritten = JsonConvert.SerializeObject(obj);
            objWritten.Should().NotBeNullOrEmpty();

            var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten);
            objRead.Should().NotBeNull();
            objRead.Value.Should().Be(TraktReleaseType.Tv);
        }

        [TestMethod]
        public void TestTraktReleaseTypeWriteAndReadJson_Unknown()
        {
            var obj = new TestObject { Value = TraktReleaseType.Unknown };

            var objWritten = JsonConvert.SerializeObject(obj);
            objWritten.Should().NotBeNullOrEmpty();

            var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten);
            objRead.Should().NotBeNull();
            objRead.Value.Should().Be(TraktReleaseType.Unknown);
        }
    }
{'fraction_non_alphanumeric': 0.1102177554438861, 'fraction_numerical': 0.00033500837520938025, 'mean_word_length': 2.439516129032258, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7588965', 'n_tokens_mistral': 1620, 'n_tokens_neox': 1545, 'n_words': 222}