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 GenericEnumerableSize() { var testCollection = new List <string> { "element1", "element2" }; var testCollectionFacet = new GenericIEnumerableFacet(specification); var testAdaptedCollection = AdapterFor(testCollection); Size(testCollectionFacet, testAdaptedCollection); }
public void GenericEnumerableGetEnumeratorFor() { var testCollection = new List <string> { "element1", "element2" }; var testCollectionFacet = new GenericIEnumerableFacet(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 GenericEnumerableFirstElement() { var testCollection = new List <string> { "element1", "element2" }; var testCollectionFacet = new GenericIEnumerableFacet(specification); INakedObjectAdapter testAdaptedCollection = AdapterFor(testCollection); FirstElement(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 GenericEnumerableSize() { var testCollection = new List<string> {"element1", "element2"}; var testCollectionFacet = new GenericIEnumerableFacet(specification); INakedObjectAdapter testAdaptedCollection = AdapterFor(testCollection); Size(testCollectionFacet, testAdaptedCollection); }