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)); }
public void TestCaseConstruction3() { var @operator = new FormatOperator("operator", CultureInfo.InvariantCulture, TypeConverter); Assert.AreEqual("operator", @operator.Symbol); Assert.AreEqual(2, @operator.Precedence); Assert.AreEqual(Associativity.LeftToRight, @operator.Associativity); Assert.AreEqual(CultureInfo.InvariantCulture, @operator.FormatProvider); }
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 TestCaseConstruction2() { var @operator = new FormatOperator(CultureInfo.CurrentCulture, TypeConverter); Assert.AreEqual(":", @operator.Symbol); }