Created
May 27, 2013 07:29
-
-
Save pedropombeiro/5655648 to your computer and use it in GitHub Desktop.
Sample Testeroids AAA-style constructor test, using triangulation in order to guarantee no hard-coded values are used in the production code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class DataSegmentSpecs | |
{ | |
[TriangulatedFixture] | |
public class after_instantiating_Sut_with_triangulated_values : SubjectInstantiationContextSpecification<DataSegment> | |
{ | |
#region Context | |
[TriangulationValues(0x00001000u, 0x80100000)] | |
private uint InjectedAddress { get; set; } | |
[TriangulationValues(new byte[0], new byte[] { 0x00, 0xFF })] | |
private byte[] InjectedData { get; set; } | |
protected override sealed DataSegment BecauseSutIsCreated() | |
{ | |
return new DataSegment(this.InjectedAddress, this.InjectedData); | |
} | |
#endregion | |
[Test] | |
public void then_Address_matches_InjectedAddress() | |
{ | |
Assert.AreEqual(this.InjectedAddress, this.Sut.Address); | |
} | |
[Test] | |
public void then_Data_is_InjectedData() | |
{ | |
Assert.AreEqual(this.InjectedData, this.Sut.Data); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment