The test class for tenth frame
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace ScratchPadTest | |
{ | |
[TestClass] | |
public class TenthFrameTest | |
{ | |
[TestClass] | |
public class Constructor | |
{ | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void Initializes_Total_To_Sum_Of_Three_Throws() | |
{ | |
const int firstThrow = 1; | |
const int secondThrow = 2; | |
const int thirdThrow = 0; | |
var frame = new TenthFrame(firstThrow, secondThrow, thirdThrow); | |
Assert.AreEqual<int>(firstThrow + secondThrow + thirdThrow, frame.Total); | |
} | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void Does_Not_Throw_Exception_On_Two_Strikes() | |
{ | |
ExtendedAssert.DoesNotThrow(() => new TenthFrame(10, 10, 9)); | |
} | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void Throws_Exception_On_First_Throw_Greater_Than_10() | |
{ | |
ExtendedAssert.Throws<Frame.OverflowException>(() => new TenthFrame(12, 0, 0)); | |
} | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void Throws_Exception_On_Throw_Less_Than_Zero() | |
{ | |
ExtendedAssert.Throws<Frame.UnderflowException>(() => new TenthFrame(2, -1, 12)); | |
} | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void Throws_Exception_For_5_10_5() | |
{ | |
ExtendedAssert.Throws<TenthFrame.IllegalFrameException>(() => new TenthFrame(5, 10, 5)); | |
} | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void Throws_For_10_5_10() | |
{ | |
ExtendedAssert.Throws<TenthFrame.IllegalFrameException>(() => new TenthFrame(10, 5, 10)); | |
} | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void Throws_Exception_On_3_4_5() | |
{ | |
ExtendedAssert.Throws<TenthFrame.IllegalFrameException>(() => new TenthFrame(3, 4, 5)); | |
} | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void Throws_Exception_On_7_5_2() | |
{ | |
ExtendedAssert.Throws<TenthFrame.IllegalFrameException>(() => new TenthFrame(4, 7, 1)); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment