Ejemplo n.º 1
0
        public void TestGetMetadata()
        {
            // Test 1: Normal case.
            MovieInfo info = new MovieInfo()
            {
                Name = "Source Code"
            };
            var meta = _provider.GetMetadata(info, CancellationToken.None).Result;

            Assert.True(meta.HasMetadata);
            Assert.Equal("源代码", meta.Item.Name);
            Assert.Equal("3075287", meta.Item.GetProviderId(BaseProvider.ProviderID));
            Assert.Equal(DateTime.Parse("2011-08-30"), meta.Item.PremiereDate);

            // Test 2: Already has provider Id.
            info = new MovieInfo()
            {
                Name = "Source Code"
            };
            info.SetProviderId(BaseProvider.ProviderID, "1851857");
            meta = _provider.GetMetadata(info, CancellationToken.None).Result;
            Assert.True(meta.HasMetadata);
            Assert.Equal("蝙蝠侠:黑暗骑士", meta.Item.Name);

            // Test 2: Not movie type.
            info = new MovieInfo()
            {
                Name = "大秦帝国"
            };
            meta = _provider.GetMetadata(info, CancellationToken.None).Result;
            Assert.False(meta.HasMetadata);
        }
        public void TestGetMetadata()
        {
            MovieInfo info = new MovieInfo()
            {
                Name             = "龙猫",
                MetadataLanguage = "en",
            };

            // Test 1: language is not "zh"
            var meta = _doubanProvider.GetMetadata(info, CancellationToken.None).Result;

            Assert.False(meta.HasMetadata);

            // Test 2: can not get the result.

            /*
             * info = new MovieInfo()
             * {
             *  MetadataLanguage = "zh",
             *  Name = "asdflkjhsadf"
             * };
             * meta = _doubanProvider.GetMetadata(info, CancellationToken.None).Result;
             * Assert.False(meta.HasMetadata);
             */

            // Test 3: get meta successfully
            info = new MovieInfo()
            {
                MetadataLanguage = "zh",
                Name             = "龙猫"
            };
            meta = _doubanProvider.GetMetadata(info, CancellationToken.None).Result;
            Assert.True(meta.HasMetadata);
            Assert.Equal("龙猫", meta.Item.Name);

            // Test 4: get it but it's not movie type
            info = new MovieInfo()
            {
                MetadataLanguage = "zh",
                Name             = "三国演义"
            };
            meta = _doubanProvider.GetMetadata(info, CancellationToken.None).Result;
            Assert.False(meta.HasMetadata);
        }
Ejemplo n.º 3
0
        public void TestGetMovieMetadata()
        {
            MovieInfo info = new MovieInfo()
            {
                Name = "Source Code"
            };
            var meta = _doubanProvider.GetMetadata(info, CancellationToken.None).Result;

            Assert.True(meta.HasMetadata);
            Assert.Equal("源代码", meta.Item.Name);
        }