Exemple #1
0
        public void Test_ShowAirsObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();
            Func <Task <ITraktShowAirs> > traktShowAirs = () => traktJsonReader.ReadObjectAsync(default(Stream));

            traktShowAirs.Should().Throw <ArgumentNullException>();
        }
Exemple #2
0
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();

            var traktShowAirs = await traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktShowAirs.Should().BeNull();
        }
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new ShowAirsObjectJsonReader();

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

            traktShowAirs.Should().BeNull();
        }
        public async Task Test_TraktShowAirs_From_Json()
        {
            var jsonReader = new ShowAirsObjectJsonReader();
            var showAirs   = await jsonReader.ReadObjectAsync(JSON) as TraktShowAirs;

            showAirs.Should().NotBeNull();
            showAirs.Day.Should().Be("Sunday");
            showAirs.Time.Should().Be("21:00");
            showAirs.TimeZoneId.Should().Be("America/New_York");
        }
Exemple #5
0
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();

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

                traktShowAirs.Should().BeNull();
            }
        }
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_Json_String_Incomplete_6()
        {
            var jsonReader = new ShowAirsObjectJsonReader();

            var traktShowAirs = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_6);

            traktShowAirs.Should().NotBeNull();
            traktShowAirs.Day.Should().BeNull();
            traktShowAirs.Time.Should().BeNull();
            traktShowAirs.TimeZoneId.Should().Be("America/New_York");
        }
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_Json_String_Not_Valid_4()
        {
            var jsonReader = new ShowAirsObjectJsonReader();

            var traktShowAirs = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_4);

            traktShowAirs.Should().NotBeNull();
            traktShowAirs.Day.Should().BeNull();
            traktShowAirs.Time.Should().BeNull();
            traktShowAirs.TimeZoneId.Should().BeNull();
        }
Exemple #8
0
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();

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

                    traktShowAirs.Should().BeNull();
                }
        }
Exemple #9
0
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_Stream_Incomplete_5()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_5.ToStream())
            {
                var traktShowAirs = await traktJsonReader.ReadObjectAsync(stream);

                traktShowAirs.Should().NotBeNull();
                traktShowAirs.Day.Should().BeNull();
                traktShowAirs.Time.Should().Be("21:00");
                traktShowAirs.TimeZoneId.Should().BeNull();
            }
        }
Exemple #10
0
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_Stream_Not_Valid_4()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();

            using (var stream = JSON_NOT_VALID_4.ToStream())
            {
                var traktShowAirs = await traktJsonReader.ReadObjectAsync(stream);

                traktShowAirs.Should().NotBeNull();
                traktShowAirs.Day.Should().BeNull();
                traktShowAirs.Time.Should().BeNull();
                traktShowAirs.TimeZoneId.Should().BeNull();
            }
        }
Exemple #11
0
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_Stream_Complete()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();

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

                traktShowAirs.Should().NotBeNull();
                traktShowAirs.Day.Should().Be("Sunday");
                traktShowAirs.Time.Should().Be("21:00");
                traktShowAirs.TimeZoneId.Should().Be("America/New_York");
            }
        }
Exemple #12
0
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_JsonReader_Incomplete_5()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();

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

                    traktShowAirs.Should().NotBeNull();
                    traktShowAirs.Day.Should().BeNull();
                    traktShowAirs.Time.Should().Be("21:00");
                    traktShowAirs.TimeZoneId.Should().BeNull();
                }
        }
Exemple #13
0
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_4()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();

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

                    traktShowAirs.Should().NotBeNull();
                    traktShowAirs.Day.Should().BeNull();
                    traktShowAirs.Time.Should().BeNull();
                    traktShowAirs.TimeZoneId.Should().BeNull();
                }
        }
Exemple #14
0
        public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new ShowAirsObjectJsonReader();

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

                    traktShowAirs.Should().NotBeNull();
                    traktShowAirs.Day.Should().Be("Sunday");
                    traktShowAirs.Time.Should().Be("21:00");
                    traktShowAirs.TimeZoneId.Should().Be("America/New_York");
                }
        }
Exemple #15
0
 public async Task Test_ShowAirsObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new ShowAirsObjectJsonReader();
     Func <Task <ITraktShowAirs> > traktShowAirs = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktShowAirs.Should().ThrowAsync <ArgumentNullException>();
 }