public async Task Test_ErrorObjectJsonWriter_WriteObject_JsonWriter_Exceptions() { var traktJsonWriter = new ErrorObjectJsonWriter(); ITraktError traktError = new TraktError(); Func <Task> action = () => traktJsonWriter.WriteObjectAsync(default(JsonTextWriter), traktError); await action.Should().ThrowAsync <ArgumentNullException>(); }
public void Test_ErrorObjectJsonWriter_WriteObject_StringWriter_Exceptions() { var traktJsonWriter = new ErrorObjectJsonWriter(); ITraktError traktError = new TraktError(); Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default(StringWriter), traktError); action.Should().Throw <ArgumentNullException>(); }
public async Task Test_ErrorObjectJsonWriter_WriteObject_Object_Empty() { ITraktError traktError = new TraktError(); var traktJsonWriter = new ErrorObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktError); json.Should().Be("{}"); }
public async Task Test_ErrorObjectJsonWriter_WriteObject_Object_Only_Description_Property() { ITraktError traktError = new TraktError { Description = "error description" }; var traktJsonWriter = new ErrorObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktError); json.Should().Be(@"{""error_description"":""error description""}"); }
public async Task Test_ErrorObjectJsonWriter_WriteObject_StringWriter_Empty() { ITraktError traktError = new TraktError(); using (var stringWriter = new StringWriter()) { var traktJsonWriter = new ErrorObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(stringWriter, traktError); json.Should().Be("{}"); } }
public async Task Test_ErrorObjectJsonWriter_WriteObject_Object_Complete() { ITraktError traktError = new TraktError { Error = "error", Description = "error description" }; var traktJsonWriter = new ErrorObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktError); json.Should().Be(@"{""error"":""error"",""error_description"":""error description""}"); }
public async Task Test_ErrorObjectJsonWriter_WriteObject_JsonWriter_Empty() { ITraktError traktError = new TraktError(); using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new ErrorObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktError); stringWriter.ToString().Should().Be("{}"); } }
public async Task Test_ErrorObjectJsonWriter_WriteObject_StringWriter_Only_Error_Property() { ITraktError traktError = new TraktError { Error = "error" }; using (var stringWriter = new StringWriter()) { var traktJsonWriter = new ErrorObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(stringWriter, traktError); json.Should().Be(@"{""error"":""error""}"); } }
public async Task Test_ErrorObjectJsonWriter_WriteObject_JsonWriter_Only_Description_Property() { ITraktError traktError = new TraktError { Description = "error description" }; using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new ErrorObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktError); stringWriter.ToString().Should().Be(@"{""error_description"":""error description""}"); } }