public void ensureFromCollectionReturnsModelViewIfCollectionIsValid() { CustomizedProductCollection customizedProductCollection = createCustomizedProductCollection(); CustomizedProductCollection otherCustomizedProductCollection = createCustomizedProductCollection(); GetAllCustomizedProductCollectionsModelView expectedModelView = new GetAllCustomizedProductCollectionsModelView(); expectedModelView = new GetAllCustomizedProductCollectionsModelView() { CustomizedProductCollectionModelViewService.fromEntityAsBasic(customizedProductCollection), CustomizedProductCollectionModelViewService.fromEntityAsBasic(otherCustomizedProductCollection) }; List <CustomizedProductCollection> collection = new List <CustomizedProductCollection>() { customizedProductCollection, otherCustomizedProductCollection }; GetAllCustomizedProductCollectionsModelView actualModelView = CustomizedProductCollectionModelViewService.fromCollection(collection); assertBasicModelView(expectedModelView[0], actualModelView[0]); assertBasicModelView(expectedModelView[1], actualModelView[1]); }
public static GetAllCustomizedProductCollectionsModelView fromCollection(IEnumerable <CustomizedProductCollection> customizedProductCollections) { if (customizedProductCollections == null) { throw new ArgumentNullException(nameof(customizedProductCollections)); } GetAllCustomizedProductCollectionsModelView customizedProductCollectionsModelView = new GetAllCustomizedProductCollectionsModelView(); foreach (CustomizedProductCollection customizedProductCollection in customizedProductCollections) { customizedProductCollectionsModelView.Add(fromEntityAsBasic(customizedProductCollection)); } return(customizedProductCollectionsModelView); }