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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?