FIT FOR DOT NET (6)----RowFixture

原创 2005年03月03日 13:34:00


Row Fixture



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
  • 下载

Office编程在dot Net环境中总结(Excel篇)

文章的使用范围    运行环境 .net Framework 1.1 ,Excel 2003    开发语言:C#   目录 1.0简要说明     2.0 Excel 编程模型的说明。 ...

dot Net 线程相关问题

把遇到过的对.Net线程的一些问题和误解集中起来和大家分享,也希望大家能一起补充,热烈欢迎讨论 目录 基础篇怎样创建一个线程受托管的线程与 Windows线程前台线程与后台线程名为BeginXXX和...

Dot NET设计模式—反射工厂

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

dot net npoi

前言 最近项目中,需要使用到 Excel 导出,找了一圈发现没有适用于 .NET Core的,不依赖Office和操作系统限制的 Office 组件,于是萌生了把 NPOI 适配并移植到 .NET C...

浅谈MVC架构在Dot NET WinForm应用程序开发中的应用(C#)

浅谈MVC架构在DotNET WinForm中的应用(C#) 浅谈MVC架构在Dot NET WinForm应用程序开发中的应用(C#) 本文目的 在各种应用程序开发过程中,随时都可...

dot net连接Sybase数据库的几种方法

dot net连接Sybase数据库的几种方法   最近搞了个电网公司的项目。因为他们的数据库是Sybase12.5.1,所以就简单学习了一下Sybase数据库。但发现网上关于它的资料很少,...
  • postfxj
  • postfxj
  • 2013年12月20日 08:46
  • 944

最强Dot Net教程资料集合

电驴资源 下面是用户共享的文件列表,安装电驴后,您可以点击这些文件名进行下载 [最强Dot.Net教程资料集合].LearnKey.Asp.Net-Part1CD1.ISO...
  • bhdzx
  • bhdzx
  • 2012年07月25日 11:05
  • 516
您举报文章:FIT FOR DOT NET (6)----RowFixture