public void WhenInstanceIsNotNullReturnsTrue() { var instance = new Object(); var result = instance.IsNotNull(); Assert.True(result); }
/// <summary> /// Writes the JSON representation of the <see langword="object"/>. /// </summary> /// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter"/> to write to.</param> /// <param name="value">The value.</param> /// <param name="serializer">The calling serializer.</param> /// <exception cref="ArgumentOutOfRangeException"> /// The <paramref name="value"/> is out of range. Value must be of type <see cref="T:System.DateTime"/> /// </exception> public override void WriteJson(JsonWriter writer, Object value, JsonSerializer serializer) { if (!(value is DateTime)) { throw new ArgumentOutOfRangeException("value", value.IsNotNull() ? value.GetType() : null, String.Format(CultureInfo.CurrentCulture, "{0}.", Resources.ValueOutOfRangeMustBeTypeDateTime)); } Debug.Assert(writer.IsNotNull(), "writer != null"); writer.WriteValue(((DateTime)value).ToUnixTime()); }