Exemple #1
0
        public void TestMaxLengthAnnotationPickedUpOnProperty()
        {
            var property = FindProperty(typeof(Customer7), "FirstName");

            facetFactory.Process(Reflector, property, MethodRemover, Specification);
            var facet = Specification.GetFacet(typeof(IMaxLengthFacet));

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

            Assert.AreEqual(30, maxLengthFacetAnnotation.Value);
        }
Exemple #2
0
        public void TestMaxLengthAnnotationPickedUpOnProperty()
        {
            IImmutableDictionary <string, ITypeSpecBuilder> metamodel = new Dictionary <string, ITypeSpecBuilder>().ToImmutableDictionary();

            var property = FindProperty(typeof(Customer7), "FirstName");

            metamodel = facetFactory.Process(Reflector, property, MethodRemover, Specification, metamodel);
            var facet = Specification.GetFacet(typeof(IMaxLengthFacet));

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

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