private static void TestWriteObj(object obj)
{
try {
{
CBORObject cborTemp1 = CBORObject.FromObject(obj);
try {
CBORObject.Write(obj, null);
Assert.Fail("Should have failed");
} catch (ArgumentNullException) {
new Object();
} catch (Exception ex) {
Assert.Fail(ex.ToString());
throw new InvalidOperationException(String.Empty, ex);
}
AssertWriteThrow(cborTemp1);
using (var ms = new MemoryStream()) {
CBORObject.Write(obj, ms);
CBORObject.Write(CBORObject.FromObject(obj), ms);
CBORObject.FromObject(obj).WriteTo(ms);
AssertReadThree(ms.ToArray());
}
}
} catch (IOException ex) {
Assert.Fail(ex.ToString());
throw new InvalidOperationException(ex.ToString(), ex);
}
}