Beispiel #1
0
        public async Task Test_CertificationsObjectStream_ReadObject_From_Stream_Complete()
        {
            var traktJsonReader = new CertificationsObjectJsonReader();

            using (var stream = JSON_COMPLETE.ToStream())
            {
                var traktCertifications = await traktJsonReader.ReadObjectAsync(stream);

                traktCertifications.Should().NotBeNull();
                traktCertifications.US.Should().NotBeNull();
                traktCertifications.US.Should().NotBeEmpty().And.HaveCount(2);

                var certifications = traktCertifications.US.ToArray();

                certifications[0].Should().NotBeNull();
                certifications[0].Name.Should().Be("PG");
                certifications[0].Slug.Should().Be("pg");
                certifications[0].Description.Should().Be("Parental Guidance Suggested");

                certifications[1].Should().NotBeNull();
                certifications[1].Name.Should().Be("PG-13");
                certifications[1].Slug.Should().Be("pg-13");
                certifications[1].Description.Should().Be("Parents Strongly Cautioned - Ages 13+ Recommended");
            }
        }
        public void Test_CertificationsObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new CertificationsObjectJsonReader();
            Func <Task <ITraktCertifications> > traktCertifications = () => jsonReader.ReadObjectAsync(default(string));

            traktCertifications.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_CertificationsObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new CertificationsObjectJsonReader();

            var traktCertifications = await jsonReader.ReadObjectAsync(string.Empty);

            traktCertifications.Should().BeNull();
        }
Beispiel #4
0
        public async Task Test_CertificationsObjectStream_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new CertificationsObjectJsonReader();

            var traktCertifications = await traktJsonReader.ReadObjectAsync(default(Stream));

            traktCertifications.Should().BeNull();
        }
        public async Task Test_CertificationsObjectJsonReader_ReadObject_From_Json_String_Not_Valid()
        {
            var jsonReader = new CertificationsObjectJsonReader();

            var traktCertifications = await jsonReader.ReadObjectAsync(JSON_NOT_VALID);

            traktCertifications.Should().NotBeNull();
            traktCertifications.US.Should().BeNull();
        }
Beispiel #6
0
        public async Task Test_CertificationsObjectStream_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new CertificationsObjectJsonReader();

            using (var stream = string.Empty.ToStream())
            {
                var traktCertifications = await traktJsonReader.ReadObjectAsync(stream);

                traktCertifications.Should().BeNull();
            }
        }
Beispiel #7
0
        public async Task Test_CertificationsObjectStream_ReadObject_From_Stream_Not_Valid()
        {
            var traktJsonReader = new CertificationsObjectJsonReader();

            using (var stream = JSON_NOT_VALID.ToStream())
            {
                var traktCertifications = await traktJsonReader.ReadObjectAsync(stream);

                traktCertifications.Should().NotBeNull();
                traktCertifications.US.Should().BeNull();
            }
        }
Beispiel #8
0
        public async Task Test_CertificationsObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new CertificationsObjectJsonReader();

            using (var reader = new StringReader(string.Empty))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktCertifications = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktCertifications.Should().BeNull();
                }
        }
Beispiel #9
0
        public async Task Test_CertificationsObjectJsonReader_ReadObject_From_JsonReader_Not_Valid()
        {
            var traktJsonReader = new CertificationsObjectJsonReader();

            using (var reader = new StringReader(JSON_NOT_VALID))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktCertifications = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktCertifications.Should().NotBeNull();
                    traktCertifications.US.Should().BeNull();
                }
        }
        public async Task Test_TraktCertifications_From_Json()
        {
            var jsonReader          = new CertificationsObjectJsonReader();
            var traktCertifications = await jsonReader.ReadObjectAsync(JSON) as TraktCertifications;

            traktCertifications.Should().NotBeNull();
            traktCertifications.US.Should().NotBeNull();
            traktCertifications.US.Should().NotBeEmpty().And.HaveCount(2);

            var certifications = traktCertifications.US.ToArray();

            certifications[0].Should().NotBeNull();
            certifications[0].Name.Should().Be("PG");
            certifications[0].Slug.Should().Be("pg");
            certifications[0].Description.Should().Be("Parental Guidance Suggested");

            certifications[1].Should().NotBeNull();
            certifications[1].Name.Should().Be("PG-13");
            certifications[1].Slug.Should().Be("pg-13");
            certifications[1].Description.Should().Be("Parents Strongly Cautioned - Ages 13+ Recommended");
        }
 public async Task Test_CertificationsObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new CertificationsObjectJsonReader();
     Func <Task <ITraktCertifications> > traktCertifications = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktCertifications.Should().ThrowAsync <ArgumentNullException>();
 }