Data sources, random/sequential generators, Equivalence classes#5
Merged
robdmoore merged 7 commits intoTestStack:anonymous-valuesfrom Sep 18, 2014
mwhelan:anonymous-values
Merged
Data sources, random/sequential generators, Equivalence classes#5robdmoore merged 7 commits intoTestStack:anonymous-valuesfrom mwhelan:anonymous-values
robdmoore merged 7 commits intoTestStack:anonymous-valuesfrom
mwhelan:anonymous-values
Conversation
robdmoore
added a commit
that referenced
this pull request
Sep 18, 2014
Data sources, random/sequential generators, Equivalence classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Put together some data sources of type string, just to be treated of samples of some ideas for discussion rather than anything in particular. They simply provide a list of strings, then a generator picks an index value to return a particular value from the list. A Random Generator picks an index value at random from 0 to List.Count. This is not guaranteed to be unique, but is reasonably unique. You might get 9 unique values and 1 duplicate out of 10 generations for example. (You would just add a Unique Random Generator if you wanted this functionality). A Sequential Generator returns each value in sequence. By default it will go back to the start of the sequence after it gets to the end of the collection, but if you specify a unique constraint during construction then it will throw an exception if it exceeds the collection.
These data sources can be used independently as Pick data sources, or consumed by Equivalence Classes for Any extensions (see CompanyEquivalenceClass example).
I also experimented with reading in data from a text file which is set as an embedded resource. I got some free sample data online that provides 500 records of people data, such as First/Last Name, City, Address etc. You can get this data for UK/US/Australia/Canada. It is initialized once and then is available during the AppDomain. At the moment, there are 3 example equivalence classes, for Any.FirstName, Any.LastName, and Any.FullName. It would be easy to do Any.Person.FirstName/LastName etc. if the number of data sources became too many...
I did not put XML comments on, but happy to do so if we decide any of these ideas are worth taking further.