private static void ProcessGenericEnumerable(Type type, ISpecification holder)
        {
            var isCollection = CollectionUtils.IsGenericCollection(type); // as opposed to IEnumerable
            var isQueryable  = CollectionUtils.IsGenericQueryable(type);
            var isSet        = CollectionUtils.IsSet(type);

            FacetUtils.AddFacet(new TypeOfFacetInferredFromGenerics(holder));

            IFacet facet;

            if (isQueryable)
            {
                facet = new GenericIQueryableFacet(holder, isSet);
            }
            else if (isCollection)
            {
                facet = new GenericCollectionFacet(holder, isSet);
            }
            else
            {
                facet = new GenericIEnumerableFacet(holder, isSet);
            }

            FacetUtils.AddFacet(facet);
        }
        public void GenericQueryableSize()
        {
            var testCollection = new List <string> {
                "element1", "element2"
            }.AsQueryable();
            var testCollectionFacet   = new GenericIQueryableFacet(specification);
            var testAdaptedCollection = AdapterFor(testCollection);

            Size(testCollectionFacet, testAdaptedCollection);
        }
        public void GenericQueryableGetEnumeratorFor()
        {
            var testCollection = new List <string> {
                "element1", "element2"
            }.AsQueryable();
            var testCollectionFacet   = new GenericIQueryableFacet(specification);
            var testAdaptedCollection = AdapterFor(testCollection);

            ValidateCollection(testCollectionFacet, testAdaptedCollection, testCollection);
        }
        public void GenericCollectionNotIsSet()
        {
            ICollectionFacet testCollectionFacet = new GenericCollectionFacet(specification);

            Assert.IsFalse(testCollectionFacet.IsASet);
            testCollectionFacet = new GenericIEnumerableFacet(specification);
            Assert.IsFalse(testCollectionFacet.IsASet);
            testCollectionFacet = new GenericIQueryableFacet(specification);
            Assert.IsFalse(testCollectionFacet.IsASet);
        }
        public void GenericCollectionIsSet()
        {
            ICollectionFacet testCollectionFacet = new GenericCollectionFacet(specification, true);

            Assert.IsTrue(testCollectionFacet.IsASet);
            testCollectionFacet = new GenericIEnumerableFacet(specification, true);
            Assert.IsTrue(testCollectionFacet.IsASet);
            testCollectionFacet = new GenericIQueryableFacet(specification, true);
            Assert.IsTrue(testCollectionFacet.IsASet);
        }
        public void GenericQueryablePage()
        {
            IQueryable <string> testCollection = new List <string> {
                "element1", "element2"
            }.AsQueryable();
            var testCollectionFacet                   = new GenericIQueryableFacet(specification);
            INakedObjectAdapter testAdaptedCollection = AdapterFor(testCollection);

            Page(testCollectionFacet, testAdaptedCollection, "element1");
        }
        private void ProcessGenericEnumerable(Type type, ISpecification holder) {
            bool isCollection = CollectionUtils.IsGenericCollection(type); // as opposed to IEnumerable 
            bool isQueryable = CollectionUtils.IsGenericQueryable(type);
            bool isSet = CollectionUtils.IsSet(type);

            FacetUtils.AddFacet(new TypeOfFacetInferredFromGenerics(holder));

            IFacet facet;
            if (isQueryable) {
                facet = new GenericIQueryableFacet(holder, isSet);
            }
            else if (isCollection) {
                facet = new GenericCollectionFacet(holder, isSet);
            }
            else {
                facet = new GenericIEnumerableFacet(holder, isSet);
            }

            FacetUtils.AddFacet(facet);
        }
 public void GenericQueryableSize() {
     IQueryable<string> testCollection = new List<string> {"element1", "element2"}.AsQueryable();
     var testCollectionFacet = new GenericIQueryableFacet(specification);
     INakedObjectAdapter testAdaptedCollection = AdapterFor(testCollection);
     Size(testCollectionFacet, testAdaptedCollection);
 }
 public void GenericCollectionNotIsSet() {
     ICollectionFacet testCollectionFacet = new GenericCollectionFacet(specification);
     Assert.IsFalse(testCollectionFacet.IsASet);
     testCollectionFacet = new GenericIEnumerableFacet(specification);
     Assert.IsFalse(testCollectionFacet.IsASet);
     testCollectionFacet = new GenericIQueryableFacet(specification);
     Assert.IsFalse(testCollectionFacet.IsASet);
 }
 public void GenericCollectionIsSet() {
     ICollectionFacet testCollectionFacet = new GenericCollectionFacet(specification, true);
     Assert.IsTrue(testCollectionFacet.IsASet);
     testCollectionFacet = new GenericIEnumerableFacet(specification, true);
     Assert.IsTrue(testCollectionFacet.IsASet);
     testCollectionFacet = new GenericIQueryableFacet(specification, true);
     Assert.IsTrue(testCollectionFacet.IsASet);
 }