public void JsonWriterException() { JsonWriterException exception = new JsonWriterException(); Assert.AreEqual("Exception of type 'Newtonsoft.Json.JsonWriterException' was thrown.", exception.Message); exception = new JsonWriterException("Message!"); Assert.AreEqual("Message!", exception.Message); Assert.AreEqual(null, exception.InnerException); exception = new JsonWriterException("Message!", new Exception("Inner!")); Assert.AreEqual("Message!", exception.Message); Assert.AreEqual("Inner!", exception.InnerException.Message); }
public void JsonWriterException() { JsonWriterException exception = new JsonWriterException(); Assert.Equal("Exception of type 'OpenGamingLibrary.Json.JsonWriterException' was thrown.", exception.Message); exception = new JsonWriterException("Message!"); Assert.Equal("Message!", exception.Message); Assert.Equal(null, exception.InnerException); exception = new JsonWriterException("Message!", new Exception("Inner!")); Assert.Equal("Message!", exception.Message); Assert.Equal("Inner!", exception.InnerException.Message); }
public void JsonWriterException() { JsonWriterException exception = new JsonWriterException(); Assert.AreEqual( "Exception of type 'Newtonsoft.Json.JsonWriterException' was thrown.", exception.Message ); exception = new JsonWriterException("Message!"); Assert.AreEqual("Message!", exception.Message); Assert.AreEqual(null, exception.InnerException); exception = new JsonWriterException("Message!", new Exception("Inner!")); Assert.AreEqual("Message!", exception.Message); Assert.AreEqual("Inner!", exception.InnerException.Message); }
internal void AddToken(BsonToken token) { if (this._parent != null) { if (!(this._parent is BsonObject)) { ((BsonArray)this._parent).Add(token); return; } ((BsonObject)this._parent).Add(this._propertyName, token); this._propertyName = null; return; } if (token.Type != BsonType.Object && token.Type != BsonType.Array) { throw JsonWriterException.Create(this, "Error writing {0} value. BSON must start with an Object or Array.".FormatWith(CultureInfo.InvariantCulture, token.Type), null); } this._parent = token; this._root = token; }
internal void method_23(Class70 class70_2) { if (this.class70_1 != null) { if (this.class70_1 is Class71) { ((Class71)this.class70_1).method_0(this.string_1, class70_2); this.string_1 = null; } else { ((Class72)this.class70_1).method_0(class70_2); } } else { if ((class70_2.Enum11_0 != Enum11.Object) && (class70_2.Enum11_0 != Enum11.Array)) { throw JsonWriterException.smethod_1(this, "Error writing {0} value. BSON must start with an Object or Array.".smethod_0(CultureInfo.InvariantCulture, class70_2.Enum11_0), null); } this.class70_1 = class70_2; this.class70_0 = class70_2; } }
internal void AddToken(BsonToken token) { if (this._parent != null) { if (this._parent is BsonObject) { ((BsonObject)this._parent).Add(this._propertyName, token); this._propertyName = (string)null; } else { ((BsonArray)this._parent).Add(token); } } else { if (token.Type != BsonType.Object && token.Type != BsonType.Array) { throw JsonWriterException.Create((JsonWriter)this, StringUtils.FormatWith("Error writing {0} value. BSON must start with an Object or Array.", (IFormatProvider)CultureInfo.InvariantCulture, (object)token.Type), (Exception)null); } this._parent = token; this._root = token; } }
/// <summary> /// Writes raw JSON where a value is expected and updates the writer's state. /// </summary> /// <param name="json">The raw JSON to write.</param> public override void WriteRawValue(string json) { throw JsonWriterException.Create(this, "Cannot write raw JSON as BSON.", null); }
/// <summary> /// Writes the start of a constructor with the given name. /// </summary> /// <param name="name">The name of the constructor.</param> public override void WriteStartConstructor(string name) { throw JsonWriterException.Create(this, "Cannot write JSON constructor as BSON.", null); }
/// <summary> /// Writes out a comment <code>/*...*/</code> containing the specified text. /// </summary> /// <param name="text">Text to place inside the comment.</param> public override void WriteComment(string text) { throw JsonWriterException.Create(this, "Cannot write JSON comment as BSON.", null); }
public override void WriteRaw(string json) { throw JsonWriterException.smethod_1(this, "Cannot write raw JSON as BSON.", null); }
public override void WriteRaw(string json) { throw JsonWriterException.Create((JsonWriter)this, "Cannot write raw JSON as BSON.", (Exception)null); }