我一直在使用家庭酿造的BDD Spec扩展来在NUnit中编写BDD样式测试,我想看看每个人都在想什么.它增加了价值吗?真是太糟糕了?如果是这样的话?那里有更好的东西吗?
这是源:https: //github.com/mjezzi/NSpec
我创建这个有两个原因
以下是测试外观的示例:
- 这些天僵尸似乎很受欢迎..
鉴于Zombie,Peson和IWeapon:
namespace Project.Tests.PersonVsZombie
{
public class Zombie
{
}
public interface IWeapon
{
void UseAgainst( Zombie zombie );
}
public class Person
{
private IWeapon _weapon;
public bool IsStillAlive { get; set; }
public Person( IWeapon weapon )
{
IsStillAlive = true;
_weapon = weapon;
}
public void Attack( Zombie zombie )
{
if( _weapon != null )
_weapon.UseAgainst( zombie );
else
IsStillAlive = false;
}
}
} …Run Code Online (Sandbox Code Playgroud)