public void TestOverflowIntArgumentOnShortParameter() { // short.MaxValue + 1 = 32768 Action parsePath = () => this.testSubject.ParsePath(new[] { "People(1)", "Fully.Qualified.Namespace.IsOlderThanShort(age=32768)" }); parsePath.ShouldThrow <ODataException>().WithMessage(ErrorStrings.MetadataBinder_CannotConvertToType("Edm.Int32", "Edm.Int16")); }
public void IfTypesCannotPromoteErrorIsThrown() { SingleValueNode node = new ConstantNode(7); var targetType = EdmCoreModel.Instance.GetSpatial(EdmPrimitiveTypeKind.GeographyMultiLineString, false); Action convertMethod = () => MetadataBindingUtils.ConvertToTypeIfNeeded(node, targetType); convertMethod.ShouldThrow <ODataException>().WithMessage(ODataErrorStrings.MetadataBinder_CannotConvertToType(node.TypeReference.FullName(), targetType.FullName())); }
public void ParsePath_IntArgumentOnShortParameter() { const string relativeUri = "People(1)/Fully.Qualified.Namespace.IsOlderThanShort(age=@age)?@age=1234"; Action parseUri = () => ParseUriAndVerify( new Uri("http://gobbledygook/" + relativeUri), (oDataPath, filterClause, orderByClause, selectExpandClause, aliasNodes) => { oDataPath.LastSegment.ShouldBeOperationSegment(HardCodedTestModel.GetFunctionForIsOlderThanShort()).As <IEdmFunction>(); aliasNodes["@age"].As <ConstantNode>().Value.Should().Be(1234); aliasNodes["@age"].As <ConstantNode>().TypeReference.FullName().Should().Be("Edm.Int16"); }); // TODO: This is a bug repro. Remove this assertion after the bug is fixed. parseUri.ShouldThrow <ODataException>().WithMessage(ODataErrorStrings.MetadataBinder_CannotConvertToType("Edm.Int32", "Edm.Int16")); }
public void TestDoubleArgumentOnSingleParameter() { Action parsePath = () => this.testSubject.ParsePath(new[] { "People(1)", "Fully.Qualified.Namespace.IsOlderThanSingle(age=123.45678987)" }); parsePath.ShouldThrow <ODataException>().WithMessage(ErrorStrings.MetadataBinder_CannotConvertToType("Edm.Double", "Edm.Single")); }