public void TestAnnotatedDataTypeOnActionParameter() { MethodInfo method = FindMethod(typeof(Test), nameof(Test.DataTypeAnnotationMethod), new[] { typeof(string) }); facetFactory.ProcessParams(Reflector, method, 0, Specification); IDataTypeFacet facet = Specification.GetFacet(typeof(IDataTypeFacet)) as IDataTypeFacet; Assert.IsNotNull(facet); Assert.IsTrue(facet is DataTypeFacetAnnotation); Assert.IsTrue(facet.DataType() == DataType.CreditCard); Assert.IsTrue(facet.CustomDataType() == ""); }
public void TestCustomDataTypeAnnotationOnProperty() { PropertyInfo property = FindProperty(typeof(Test), nameof(Test.CustomDataTypeAnnotation)); facetFactory.Process(Reflector, property, MethodRemover, Specification); IDataTypeFacet facet = Specification.GetFacet(typeof(IDataTypeFacet)) as IDataTypeFacet; Assert.IsNotNull(facet); Assert.IsTrue(facet is DataTypeFacetAnnotation); Assert.IsTrue(facet.DataType() == DataType.Custom); Assert.IsTrue(facet.CustomDataType() == "CustomDataType"); }
public void TestCustomDataTypeAnnotationOnProperty() { IImmutableDictionary <string, ITypeSpecBuilder> metamodel = new Dictionary <string, ITypeSpecBuilder>().ToImmutableDictionary(); PropertyInfo property = FindProperty(typeof(Test), nameof(Test.CustomDataTypeAnnotation)); metamodel = facetFactory.Process(Reflector, property, MethodRemover, Specification, metamodel); IDataTypeFacet facet = Specification.GetFacet(typeof(IDataTypeFacet)) as IDataTypeFacet; Assert.IsNotNull(facet); Assert.IsTrue(facet is DataTypeFacetAnnotation); Assert.IsTrue(facet.DataType() == DataType.Custom); Assert.IsTrue(facet.CustomDataType() == "CustomDataType"); Assert.IsNotNull(metamodel); }
public void TestAnnotatedCustomDataTypeOnActionParameter() { IImmutableDictionary <string, ITypeSpecBuilder> metamodel = new Dictionary <string, ITypeSpecBuilder>().ToImmutableDictionary(); MethodInfo method = FindMethod(typeof(Test), nameof(Test.CustomDataTypeMethod), new[] { typeof(string) }); metamodel = facetFactory.ProcessParams(Reflector, method, 0, Specification, metamodel); IDataTypeFacet facet = Specification.GetFacet(typeof(IDataTypeFacet)) as IDataTypeFacet; Assert.IsNotNull(facet); Assert.IsTrue(facet is DataTypeFacetAnnotation); Assert.IsTrue(facet.DataType() == DataType.Custom); Assert.IsTrue(facet.CustomDataType() == "CustomDataType"); Assert.IsNotNull(metamodel); }