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

    [TestClass]
    public class TraktSyncTypeTests
    {
        [TestMethod]
        public void TestTraktSyncTypeHasMembers()
        {
            typeof(TraktSyncType).GetEnumNames().Should().HaveCount(3)
                                                         .And.Contain("Unspecified", "Movie", "Episode");
        }

        [TestMethod]
        public void TestTraktSyncTypeGetAsString()
        {
            TraktSyncType.Unspecified.AsString().Should().NotBeNull().And.BeEmpty();
            TraktSyncType.Movie.AsString().Should().Be("movie");
            TraktSyncType.Episode.AsString().Should().Be("episode");
        }

        [TestMethod]
        public void TestTraktSyncTypeGetAsStringUriParameter()
        {
            TraktSyncType.Unspecified.AsStringUriParameter().Should().NotBeNull().And.BeEmpty();
            TraktSyncType.Movie.AsStringUriParameter().Should().Be("movies");
            TraktSyncType.Episode.AsStringUriParameter().Should().Be("episodes");
        }
    }
}<commit_msg>Add unit tests for enum sync 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 TraktSyncTypeTests
    {
        class TestObject
        {
            [JsonConverter(typeof(TraktSyncTypeConverter))]
            public TraktSyncType Value { get; set; }
        }

        [TestMethod]
        public void TestTraktSyncTypeHasMembers()
        {
            typeof(TraktSyncType).GetEnumNames().Should().HaveCount(3)
                                                         .And.Contain("Unspecified", "Movie", "Episode");
        }

        [TestMethod]
        public void TestTraktSyncTypeGetAsString()
        {
            TraktSyncType.Unspecified.AsString().Should().NotBeNull().And.BeEmpty();
            TraktSyncType.Movie.AsString().Should().Be("movie");
            TraktSyncType.Episode.AsString().Should().Be("episode");
        }

        [TestMethod]
        public void TestTraktSyncTypeGetAsStringUriParameter()
        {
            TraktSyncType.Unspecified.AsStringUriParameter().Should().NotBeNull().And.BeEmpty();
            TraktSyncType.Movie.AsStringUriParameter().Should().Be("movies");
            TraktSyncType.Episode.AsStringUriParameter().Should().Be("episodes");
        }

        [TestMethod]
        public void TestTraktSyncTypeWriteAndReadJson_Movie()
        {
            var obj = new TestObject { Value = TraktSyncType.Movie };

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

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

        [TestMethod]
        public void TestTraktSyncTypeWriteAndReadJson_Episode()
        {
            var obj = new TestObject { Value = TraktSyncType.Episode };

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

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

        [TestMethod]
        public void TestTraktSyncTypeWriteAndReadJson_Unspecified()
        {
            var obj = new TestObject { Value = TraktSyncType.Unspecified };

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

            var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten);
            objRead.Should().NotBeNull();
            objRead.Value.Should().Be(TraktSyncType.Unspecified);
        }
    }
}
{'fraction_non_alphanumeric': 0.1092436974789916, 'fraction_numerical': 0.0004943153732081067, 'mean_word_length': 2.3336079077429983, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4821732', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1081, 'n_words': 144}