Fit for Dot Net (6) ---- RowFixTure

xiaoxiao2021-03-06  40

For columnFixTure, I think it is more complicated, so I don't use it, here I tell it, many of whom comes from its website.

Row FixTure

RowFixTure compares the objects of the test data and the objects of the system, the method is called on the object and the return value compared to the table data, and an algorithm is in line with a row with one or more key objects. Objects can be omission, or More, these are needed.

The following Q & A is from its website:

Q: RowFixture.match is kind of hard to understand Obviously I did not know anything about it but some more info on its matching algorithm on its wiki page might help the novice reader like me Do you think that it could be refactored to help.. THE COMMON BRAINS LIKE MINE GROK IT?

A: RowFixture was very hard to get right until I found the current factoring The algorithm is a variation on the bucket sort where two parallel sorts are taking place, one of the expected rows and another for the computed rows..

http://www.nist.gov/dads ... /bucketsort.html

The FixTure Processes All The Rows of One Table Following these Five Steps:

bind the columns to variables and methods by reflection. query to get the result rows which will be checked. match the expected and result rows and check the matches. build html for missing rows. mark mark missing and surplus rows as such.

The Most Complex. The Matching Algorithm IS One of Divide and Conquer Using A Method That Calls Itself Recursively In Two Circumstances:

recurse matching subsets of the expected and computed rows distinguished by unique values ​​in a specific column. recurse so as to examine the next available column when the current column does not successfuly bind to any field or method.

Each invocation of the method divides the expected and computed rows into sublists with equal values ​​in the current column of interest. (This is the "sort" step, as in sorting clothes into like piles.) Each sublist (pile) is considered in turn There is Four Cases:

the expected list is empty so computed rows are surplus. the computed list is empty so expected rows are missing. there is exactly one row in each list so compare them. otherwise the match is ambiguous so further sorting on subsequent columns is required.The method Uses Several Helper Functions Which Are Sometimes duplicated BECAUSE OF REPRESENTATIONAL DIFEENCES BETWEEN THE EXPECTED ROWS (PARSE Objects) and the compute rows (domain objects).

转载请注明原文地址:https://www.9cbs.com/read-51318.html

New Post(0)