public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { var oid = value as SimoId; if (SimoId.IsNullOrEmpty(oid)) { throw new SerializationException(ExceptionMessages.SimoObjectIdJsonConverter_InvalidId); } var bsonWriter = writer as BsonWriter; if (bsonWriter != null) { bsonWriter.WriteObjectId(oid); } else { writer.WriteValue(oid.Value); } }
public void IsNullOrEmpty_ForNull_IsTrue() { Assert.IsTrue(SimoId.IsNullOrEmpty(null)); }
public void IsNullOrEmpty_ForEmpty_IsTrue() { var id = SimoId.Empty; Assert.IsTrue(SimoId.IsNullOrEmpty(id)); }