LinelistDataStub
Stands in for the linelist specifications object that CrossTable is handed at creation. CrossTable asks that object for two things only: TransObject, for the translated labels it writes, and Categories, which TableSpecs asks on its behalf when it resolves the row and column categories of a table. This stub answers both, and a test seeds each one so the layout under test is driven by known data.
WHY A STUB AND NOT THE REAL CLASS
LinelistSpecs is 1,536 lines and its own dependency closure names six more classes across four folders. CrossTable.Create types the parameter Object for that reason, so the test workbook needs none of them.
Depends on: BetterArray, TranslationObject
Internal members (not exported)
Seeding
SetTransObject #
set-trans-object
Store the translation object the stub hands back.
Signature:
Public Sub SetTransObject(ByVal trans As TranslationObject)
Members a test calls to load the stub before handing it over.
Parameters:
trans: TranslationObject. The translation object to store.
SetCategories #
set-categories
Store the categories of one variable.
Signature:
Public Sub SetCategories(ByVal varName As String, ByVal categories As BetterArray)
Later calls for the same variable name replace the earlier list. Collection keys are matched without regard to case, which is how the dictionary matches a variable name too.
The list is copied into a one-based array whatever bounds it arrived with, because LLChoices.Categories sets LowerBound to 1 and everything that reads a category list reads it from there. A stub answering a zero-based list would test the readers against a shape they never meet.
Parameters:
varName: String. The variable name the categories belong to.categories: BetterArray. The category list to answer for that variable.
SetCategoriesVerbatim #
set-categories-verbatim
Store the categories of one variable with the bounds they arrived with.
Signature:
Public Sub SetCategoriesVerbatim(ByVal varName As String, _
ByVal categories As BetterArray)
SetCategories normalises to a one-based list because that is what the real choices class answers. This member skips the normalisation, so a test can hand a reader a list starting at zero and check that the reader copes. One reader used to walk index one to Length regardless of where the list started, which read one past the end of a zero-based list.
Parameters:
varName: String. The variable name the categories belong to.categories: BetterArray. The category list to answer, bounds untouched.
ClearCategories #
clear-categories
Forget every seeded category list.
Signature:
Public Sub ClearCategories()
Members CrossTable reads
TransObject #
trans-object
The translation object for locale-aware labels.
Signature:
Public Property Get TransObject() As TranslationObject
Returns: TranslationObject. The stored translation object.
Categories #
categories
Categories of one variable.
Signature:
Public Function Categories(ByVal varName As String) As BetterArray
Answers the list a test seeded for varName. A variable with nothing seeded answers an empty list, which is what the real class answers for a variable that carries no choices.
Parameters:
varName: String. The variable whose categories are wanted.
Returns: BetterArray. The seeded categories, or an empty list.
Used in (3 file(s))
- TestCrossTable.bas
- TestCrossTableFormula.bas
- TestSpatialTables.bas