public async Task Test_CountryObjectJsonWriter_WriteObject_JsonWriter_Exceptions()
 {
     var           traktJsonWriter = new CountryObjectJsonWriter();
     ITraktCountry traktCountry    = new TraktCountry();
     Func <Task>   action          = () => traktJsonWriter.WriteObjectAsync(default(JsonTextWriter), traktCountry);
     await action.Should().ThrowAsync <ArgumentNullException>();
 }
Example #2
0
        public void Test_CountryObjectJsonWriter_WriteObject_StringWriter_Exceptions()
        {
            var                   traktJsonWriter = new CountryObjectJsonWriter();
            ITraktCountry         traktCountry    = new TraktCountry();
            Func <Task <string> > action          = () => traktJsonWriter.WriteObjectAsync(default(StringWriter), traktCountry);

            action.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_CountryObjectJsonWriter_WriteObject_StringWriter_Only_Code_Property()
        {
            ITraktCountry traktCountry = new TraktCountry
            {
                Code = "au"
            };

            using (var stringWriter = new StringWriter())
            {
                var    traktJsonWriter = new CountryObjectJsonWriter();
                string json            = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCountry);

                json.Should().Be(@"{""code"":""au""}");
            }
        }
        public async Task Test_CountryObjectJsonWriter_WriteObject_JsonWriter_Only_Name_Property()
        {
            ITraktCountry traktCountry = new TraktCountry
            {
                Name = "Australia"
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new CountryObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCountry);

                    stringWriter.ToString().Should().Be(@"{""name"":""Australia""}");
                }
        }
        public async Task Test_CountryObjectJsonWriter_WriteObject_StringWriter_Complete()
        {
            ITraktCountry traktCountry = new TraktCountry
            {
                Name = "Australia",
                Code = "au"
            };

            using (var stringWriter = new StringWriter())
            {
                var    traktJsonWriter = new CountryObjectJsonWriter();
                string json            = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCountry);

                json.Should().Be(@"{""name"":""Australia"",""code"":""au""}");
            }
        }
Example #6
0
 public async Task Test_CountryObjectJsonWriter_WriteObject_Object_Exceptions()
 {
     var traktJsonWriter          = new CountryObjectJsonWriter();
     Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default);