public void SeriesMappings_MapsAllFields()
        {
            var source = new TvDbSeriesData(1, "SeriesName", new DateTime(2017, 1, 2, 3, 4, 5), "Network", 30,
                                            AirDay.Monday, "6am", 55.6f, new[] { "Alias" },
                                            new[] { "Genre1", "Genre2", "Genre3", "Tag1", "Tag2" }, "Overview");

            var target = new MetadataResult <Series>
            {
                Item = new Series()
            };

            var tvDbSourceMappingConfiguration = new TvDbSourceMappingConfiguration();

            tvDbSourceMappingConfiguration.GetSeriesMappings(3, true, true, TitleType.Localized, "en")
            .All(m => m.CanApply(source, target))
            .Should()
            .BeTrue();

            tvDbSourceMappingConfiguration.GetSeriesMappings(3, true, true, TitleType.Localized, "en")
            .Iter(m => m.Apply(source, target));

            target.Item.PremiereDate.Should().Be(new DateTime(2017, 1, 2, 3, 4, 5));
            target.Item.Overview.Should().Be("Overview");
            target.Item.Genres.Should().BeEquivalentTo("Genre1", "Genre2", "Genre3");
            target.Item.Tags.Should().BeEquivalentTo("Tag1", "Tag2");
            target.Item.CommunityRating.Should().Be(55.6f);
            target.Item.AirDays.Should().BeEquivalentTo(new[] { DayOfWeek.Monday });
            target.Item.AirTime.Should().Be("6am");
        }
        public void SeriesMappings_DontMapEmptyFields()
        {
            var source = new TvDbSeriesData(1, "SeriesName", Option <DateTime> .None, "Network", 30,
                                            Option <AirDay> .None, "6am", 0, new[] { "Alias" },
                                            new[] { "Genre1", "Genre2", "Genre3", "Tag1", "Tag2" }, "");

            var target = new MetadataResult <Series>
            {
                Item = new Series()
            };

            var tvDbSourceMappingConfiguration = new TvDbSourceMappingConfiguration();

            tvDbSourceMappingConfiguration.GetSeriesMappings(3, true, true, TitleType.Localized, "en")
            .Where(m => !m.CanApply(source, target))
            .Select(m => m.TargetPropertyName)
            .Should()
            .BeEquivalentTo(nameof(target.Item.PremiereDate), nameof(target.Item.CommunityRating),
                            nameof(target.Item.Overview), nameof(target.Item.AirDays));
        }
        public void SeriesMappings_HasMappingsForAllFields()
        {
            var expectedMappedFields = new[]
            {
                nameof(Series.Name),
                nameof(Series.PremiereDate),
                nameof(Series.Overview),
                nameof(Series.CommunityRating),
                nameof(Series.Genres),
                nameof(Series.Tags),
                nameof(Series.AirDays),
                nameof(Series.AirTime)
            };

            var tvDbSourceMappingConfiguration = new TvDbSourceMappingConfiguration();

            tvDbSourceMappingConfiguration.GetSeriesMappings(3, true, true, TitleType.Localized, "en")
            .Select(m => m.TargetPropertyName)
            .Should()
            .BeEquivalentTo(expectedMappedFields);
        }