TDD的测试框架 Machine.Specification

码农软件 · 软件分类 · 测试工具 · 2019-11-23 22:13:52

软件介绍

Machine.Specification 是一个 TDD 测试驱动开发的测试框架,简化了测试,无需关心语言本身特性。

Machine.Specifications 带来的好处是不需要在代码里有注释,但同时阅读代码的人可以一目了然这个测试是在什么样的context下,because of 怎样的一个操作,should生成什么样的结果.

Machine.Specification还有一个不错的功能就是支持Behavior. 比方说, 你有好几个测试都需要测一些共同的功能, 这时你可以把这些共同的功能提出来放到Behavior中, 注意尖括号里面的内容是下面有[Behaviors]属性类的名称.

测试示例代码:

[Subject(typeof(HomeController))]
 public class When_getting_index_page
{
    static HomeController controller;
    static ViewResult result;
    static ViewDataDictionary viewData;

    Establish context =
        () =>
        {
            controller = new HomeController();
            result = controller.Index() as ViewResult;
        };

    Because of =
        () => viewData = result.ViewData;

    It should_have_the_welcome_message =
        () => viewData["Message"].ShouldEqual("Welcome to ASP.MET MVC!");
}

本文地址:https://www.codercto.com/soft/d/19653.html

Large-Scale Inference

Large-Scale Inference

Bradley Efron / Cambridge University Press / 2010-8-5 / GBP 48.00

We live in a new age for statistical inference, where modern scientific technology such as microarrays and fMRI machines routinely produce thousands and sometimes millions of parallel data sets, each ......一起来看看 《Large-Scale Inference》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具