public void TestTimeOfDayConstant() { var constant = new EdmTimeOfDayConstant(new TimeOfDay()); Assert.AreEqual(EdmValueKind.TimeOfDay, constant.ValueKind, "Invalid value kind."); this.ValidateEdmValueKindRoundTrip(EdmValueKind.TimeOfDay, EdmCoreModel.Instance.GetTimeOfDay(true), constant); }
public void BuildEdmExpression_Works_ForTimeOfDayValue() { // Arrange IEdmType edmType = EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.TimeOfDay); // Act IEdmExpression exp = IEdmTermExtensions.BuildEdmExpression(edmType, "21:45:00"); // Assert Assert.NotNull(exp); EdmTimeOfDayConstant constant = Assert.IsType <EdmTimeOfDayConstant>(exp); Assert.Equal(new TimeOfDay(21, 45, 0, 0), constant.Value); }
public void EdmTimeOfDayConstant() { var e = new EdmTimeOfDayConstant(new TimeOfDay(12, 30, 50, 0)); Assert.AreEqual(EdmExpressionKind.TimeOfDayConstant, e.ExpressionKind, "e.ExpressionKind"); Assert.IsNull(e.Type, "e.Type"); Assert.AreEqual(new TimeOfDay(12, 30, 50, 0), e.Value, "e.Value"); e = new EdmTimeOfDayConstant(EdmCoreModel.Instance.GetTimeOfDay(true), new TimeOfDay(1, 5, 10, 10)); Assert.AreEqual(e.Type.AsPrimitive().PrimitiveKind(), EdmPrimitiveTypeKind.TimeOfDay); Assert.AreEqual(new TimeOfDay(1, 5, 10, 10), e.Value, "e.Value"); e = new EdmTimeOfDayConstant(null, new TimeOfDay(23, 50, 11, 999)); Assert.IsNull(e.Type, "e.Type"); Assert.IsFalse(e.IsBad(), "Expression not bad."); Assert.AreEqual(0, e.Errors().Count(), "Expression has no errors"); }