machine.specifications

Machine.Specifications is a Context/Specification framework geared towards removing language noise and simplifying tests.

Github星跟踪图

Documentation

For project documentation, please visit the wiki.

Training

A PluralSight course by @kevinkuebler is available here.

Overview

MSpec is called a "context/specification" test framework because of the "grammar" that is used in describing and coding the tests or "specs". That grammar reads roughly like this

When the system is in such a state, and a certain action occurs, it should do such-and-such or be in some end state.

You should be able to see the components of the traditional Arrange-Act-Assert model in there. To support readability and remove as much "noise" as possible, MSpec eschews the traditional attribute-on-method model of test construction. It instead uses custom .NET delegates that you assign anonymous methods and asks you to name them following a certain convention.

[Subject("Authentication")]
class When_authenticating_an_admin_user
{
    static SecurityService subject;
    static UserToken user_token;

    Establish context = () => 
        subject = new SecurityService();

    Because of = () =>
        user_token = subject.Authenticate("username", "password");

    It should_indicate_the_users_role = () =>
        user_token.Role.ShouldEqual(Roles.Admin);

    It should_have_a_unique_session_id = () =>
        user_token.SessionId.ShouldNotBeNull();
}

Build status

Project, CI, NuGet
--, --, --
Machine.Specifications, ,
Machine.Specifications.Reporting, ,
Machine.Specifications.Runner.Console, ,
Machine.Specifications.Runner.ReSharper, ,
Machine.Specifications.Runner.Rider, ,
Machine.Specifications.Runner.TDNet, ,
Machine.Specifications.Runner.Utility, ,
Machine.Specifications.Runner.VisualStudio, ,
Machine.Specifications.Should, ,
Machine.Fakes, ,

主要指标

概览
名称与所有者machine/machine.specifications
主编程语言C#
编程语言C# (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2009-02-05 03:04:48
推送于2025-05-17 22:52:33
最后一次提交2024-12-20 21:29:09
发布数16
最新版本名称v1.1.3 (发布于 )
第一版名称0.6.0 (发布于 2013-12-18 23:55:38)
用户参与
星数895
关注者数45
派生数180
提交数1.7k
已启用问题?
问题数323
打开的问题数26
拉请求数94
打开的拉请求数2
关闭的拉请求数118
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?