This When Then style is closely related to the Assert Act Assert style for unit testing.
Here is an example:
[Test] public void RotateAngle_Given27Degress_Returns64Degrees() { //Arrange or Given var someAngleClass = new Angle(); //Act or When var result = someAngleClass.Rotate(27); //Assert or Then Assert.That(result, Is.EqualTo(64)); }
The great thing about this testing style is that you donโt need to see the underlying code to understand the intent of the behavior.
For more information, see several sites:
http://www.arrangeactassert.com/
Roy Osherov Blog
http://www.artofunittesting.com/
Joseph
source share