예제 #1
0
        public void TestMaxLengthAnnotationPickedUpOnActionParameter()
        {
            var method = FindMethod(typeof(Customer8), "SomeAction", new[] { typeof(string) });

            facetFactory.ProcessParams(Reflector, method, 0, Specification);
            var facet = Specification.GetFacet(typeof(IMaxLengthFacet));

            Assert.IsNotNull(facet);
            Assert.IsTrue(facet is MaxLengthFacetAnnotation);
            var maxLengthFacetAnnotation = (MaxLengthFacetAnnotation)facet;

            Assert.AreEqual(20, maxLengthFacetAnnotation.Value);
        }
예제 #2
0
        public void TestMaxLengthAnnotationPickedUpOnActionParameter()
        {
            IImmutableDictionary <string, ITypeSpecBuilder> metamodel = new Dictionary <string, ITypeSpecBuilder>().ToImmutableDictionary();

            var method = FindMethod(typeof(Customer8), "SomeAction", new[] { typeof(string) });

            metamodel = facetFactory.ProcessParams(Reflector, method, 0, Specification, metamodel);
            var facet = Specification.GetFacet(typeof(IMaxLengthFacet));

            Assert.IsNotNull(facet);
            Assert.IsTrue(facet is MaxLengthFacetAnnotation);
            var maxLengthFacetAnnotation = (MaxLengthFacetAnnotation)facet;

            Assert.AreEqual(20, maxLengthFacetAnnotation.Value);
            Assert.IsNotNull(metamodel);
        }