public void Test_NetworkObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new NetworkObjectJsonReader();
            Func <Task <ITraktNetwork> > traktNetwork = () => jsonReader.ReadObjectAsync(default(string));

            traktNetwork.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new NetworkObjectJsonReader();

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

            traktNetwork.Should().BeNull();
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new NetworkObjectJsonReader();

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

            traktNetwork.Should().BeNull();
        }
Exemple #4
0
        public async Task Test_TraktNetwork_From_Json()
        {
            var jsonReader   = new NetworkObjectJsonReader();
            var traktNetwork = await jsonReader.ReadObjectAsync(JSON) as TraktNetwork;

            traktNetwork.Should().NotBeNull();
            traktNetwork.Network.Should().Be("ABC(US)");
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_Json_String_Not_Valid()
        {
            var jsonReader = new NetworkObjectJsonReader();

            var traktNetwork = await jsonReader.ReadObjectAsync(JSON_NOT_VALID);

            traktNetwork.Should().NotBeNull();
            traktNetwork.Name.Should().BeNull();
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_Json_String_Complete()
        {
            var jsonReader = new NetworkObjectJsonReader();

            var traktNetwork = await jsonReader.ReadObjectAsync(JSON_COMPLETE);

            traktNetwork.Should().NotBeNull();
            traktNetwork.Name.Should().Be("ABC(US)");
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new NetworkObjectJsonReader();

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

                traktNetwork.Should().BeNull();
            }
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_Stream_Not_Valid()
        {
            var traktJsonReader = new NetworkObjectJsonReader();

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

                traktNetwork.Should().NotBeNull();
                traktNetwork.Network.Should().BeNull();
            }
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_Stream_Complete()
        {
            var traktJsonReader = new NetworkObjectJsonReader();

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

                traktNetwork.Should().NotBeNull();
                traktNetwork.Network.Should().Be("ABC(US)");
            }
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new NetworkObjectJsonReader();

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

                    traktNetwork.Should().BeNull();
                }
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_JsonReader_Not_Valid()
        {
            var traktJsonReader = new NetworkObjectJsonReader();

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

                    traktNetwork.Should().NotBeNull();
                    traktNetwork.Name.Should().BeNull();
                }
        }
        public async Task Test_NetworkObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new NetworkObjectJsonReader();

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

                    traktNetwork.Should().NotBeNull();
                    traktNetwork.Name.Should().Be("ABC(US)");
                }
        }
 public async Task Test_NetworkObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new NetworkObjectJsonReader();
     Func <Task <ITraktNetwork> > traktNetwork = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktNetwork.Should().ThrowAsync <ArgumentNullException>();
 }