# Row Fixture

RowFixture将测试数据的行和测试下系统的对象作比较,方法在对象以及与表数据比较的返回值上调用,一个算法符合带有基于一个或者多个键对象的行.对象可以遗漏,也可多余,这些都是需要注意的.

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.

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.

Of these steps the match is 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 doesn't 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 are 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 differences between the expected rows (Parse objects) and the computed rows (Domain objects).

• 本文已收录于以下专栏：

## Node.js for dot net

• 2016-02-08 14:35
• 12.63MB
• 下载

## Debugging App For dot NET And Windows

• 2008-06-13 16:10
• 8.33MB
• 下载

## Architecting Microsoft Dot NET Solutions for the Enterprise

• 2012-06-30 15:30
• 2.56MB
• 下载

## Addison Wesley Essential C Sharp 3.0 For dot NET Framework.3.5

• 2008-09-24 20:18
• 3.50MB
• 下载

## MS Press Building Dot NET Applications for Mobile Devices

• 2008-10-03 00:56
• 7.48MB
• 下载

## CodeRush for Visual Studio Dot NET v2.0.4 含注册机

• 2008-12-02 15:27
• 9.80MB
• 下载

## Dot NET设计模式—反射工厂

Dot NET设计模式—反射工厂  1．概述         如果采用传统方式实现了简单工厂、工厂方法和抽象工厂在有些场合下如此处理，代码会变得冗余并且难以维护。         假设我们需要创...

## dot Net 线程相关问题

举报原因： 您举报文章：深度学习：神经网络中的前向传播和反向传播算法推导 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)