public void TestCaseEvaluation() { var @operator = new FormatOperator(CultureInfo.InvariantCulture, TypeConverter); Assert.AreEqual("1.23", @operator.Evaluate(EmptyEvaluationContext, 1.23, "N")); Assert.IsNull(@operator.Evaluate(EmptyEvaluationContext, null, "N")); Assert.IsNull(@operator.Evaluate(EmptyEvaluationContext, "Hello", "8742398472984")); Assert.IsNull(@operator.Evaluate(EmptyEvaluationContext, "Hello", null)); var now = DateTime.Now; Assert.AreEqual(now.ToString("g", CultureInfo.InvariantCulture), @operator.Evaluate(EmptyEvaluationContext, now, "g")); }
public void TestCaseEvaluationExceptions() { var @operator = new FormatOperator(CultureInfo.InvariantCulture, TypeConverter); ExpectArgumentNullException("context", () => @operator.Evaluate(null, 1, 2)); ExpectArgumentNullException("context", () => @operator.EvaluateLhs(null, 1, out object dummy)); }