public void DeadCell_WithFewerThan3LiveNeighbors_StaysDead(int liveNeighbors) { var currentState = CellState.Dead; CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); Assert.Equal(CellState.Dead, newState); }
public void LiveCell_2Or3LiveNeighbors_Lives([Values(2, 3)] int liveNeighbors) { var currentState = CellState.Alive; CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); Assert.AreEqual(CellState.Alive, newState); }
public void DeadCell_MoreThan3LiveNeighbors_StaysDead([Range(4, 8)] int liveNeighbors) { var currentState = CellState.Dead; CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); Assert.AreEqual(CellState.Dead, newState); }
public void DeadCell_FewerThan3LiveNeighbors_StaysDead([Values(0, 1, 2)] int liveNeighbors) { var currentState = CellState.Dead; CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); Assert.AreEqual(CellState.Dead, newState); }
public void CurrentState_When2_ThrowsArgumentException() { var currentState = (CellState)2; var liveNeighbors = 0; Assert.Throws <ArgumentOutOfRangeException>(() => LifeRules.GetNewState(currentState, liveNeighbors)); }
public void LiveCell_FewerThan2LiveNeighbors_Dies([Values(0, 1)] int liveNeighbors) { var currentState = CellState.Alive; CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); Assert.AreEqual(CellState.Dead, newState); }
public void LiveCell_MoreThan3Neighbors_Dies([Range(4, 8)] int liveNeighbors) { var currentState = CellState.Alive; CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); Assert.AreEqual(CellState.Dead, newState); }
public void LiveCell_TwoOrThreeLiveNeighbours_LivestoNextGeneration() { Cellstate currentState = Cellstate.Alive; int liveNeghbours = 3; Cellstate result = LifeRules.GetNewState(currentState, liveNeghbours); Assert.AreEqual(Cellstate.Alive, result); }
public void DeadCell_Exactly3LiveNeighbors_Lives() { int liveNeighbors = 3; var currentState = CellState.Dead; CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); Assert.AreEqual(CellState.Alive, newState); }
public void DeadCell_ExactlyThreeLiveNeighbors_Lives([Values(3)] int liveNeighbors) { var currentState = CellState.Dead; CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); Assert.AreEqual(CellState.Alive, newState); }
public void DeadCell_ExactlyThreeLiveNeighbours_BecomesLiveByReproduction() { Cellstate currentState = Cellstate.Dead; int liveNeghbours = 3; Cellstate result = LifeRules.GetNewState(currentState, liveNeghbours); Assert.AreEqual(Cellstate.Alive, result); }
public void LiveCell_MoreThanThreeLiveNeighbours_DiesByOverpopulation() { Cellstate currentState = Cellstate.Alive; int liveNeghbours = 4; Cellstate result = LifeRules.GetNewState(currentState, liveNeghbours); Assert.AreEqual(Cellstate.Dead, result); }
public void LiveCell_TwoOrThreeLiveNeighbors_Lives(CellState currentState, int liveNeighbors) { // Act var result = LifeRules.GetNewState(currentState, liveNeighbors); // Assert Assert.Equal(CellState.Alive, result); }
public void AnyLiveCellWithFewerthanTwoLiveNeighborsDiesAsIfByUnderPopulation() { Cellstate currentState = Cellstate.Alive; int liveNeighbours = 1; Cellstate result = LifeRules.GetNewState(currentState, liveNeighbours); Assert.AreEqual(Cellstate.Dead, result); }
public void DeadCell_NotExactlyThreeLiveNeighbors_Dead(CellState currentState, int liveNeighbors) { // Act var result = LifeRules.GetNewState(currentState, liveNeighbors); // Assert Assert.Equal(CellState.Dead, result); }
public void LiveCell_MoreThanThreeLiveNeighbors_Dies(CellState currentState, int liveNeighbors) { // Act var result = LifeRules.GetNewState(currentState, liveNeighbors); // Assert Assert.Equal(CellState.Dead, result); }
public void LiveCell_FewerThan2LiveNeighbours_Dies() { var currentState = CellState.Alive; var liveNeighbours = 0; CellState newState = LifeRules.GetNewState(currentState, liveNeighbours); Assert.AreEqual(CellState.Dead, newState); }
public void DeadCell_FewerThan3LiveNeighbors_StaysDead([Range(0, 2)] int liveNeighbors) { //Arrange var currentState = CellState.Dead; // Act CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); // Assert Assert.AreEqual(CellState.Dead, newState); }
public void DeadCell_With3LiveNeighbors_BecomesAlive() { var liveNeighbors = 3; var currentState = CellState.Dead; CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); Assert.Equal(CellState.Alive, newState); }
public void CurrentState_When2_ThrowsArgumentException() { var currentState = (CellState)2; int liveNeighbors = 2; var exception = Record.Exception(() => LifeRules.GetNewState(currentState, liveNeighbors)); Assert.NotNull(exception); Assert.IsType <ArgumentOutOfRangeException>(exception); }
public void LiveNeighbours_InvalidValues_ThrowsArgumentException([Values(-1, 9)] int liveNeighbours) { // Arrange CellState currentState = CellState.Alive; // Assert Assert.Throws(Is.TypeOf <ArgumentOutOfRangeException>().And.Property("ParamName").EqualTo(nameof(liveNeighbours)) // Act , () => LifeRules.GetNewState(currentState, liveNeighbours)); }
public void CurrentState_UndefinedValue_ThrowsArgumentException([Values(-1, 2)] CellState currentState) { // Arrange int liveNeighbours = 0; // Act var e = Assert.Throws <ArgumentOutOfRangeException>(() => LifeRules.GetNewState(currentState, liveNeighbours)); // Assert Assert.AreEqual(e.ParamName, nameof(currentState)); }
public void LiveNeighbors_LessThan0_ThrowsArgumentException() { var currentState = CellState.Alive; int liveNeighbors = -1; var paramName = "liveNeighbors"; Assert.Throws <ArgumentOutOfRangeException>( paramName, () => LifeRules.GetNewState(currentState, liveNeighbors)); }
public void Live_Cell_With_More_Than_Three_Neighbors_Dies(string currentState, int numberOfLiveNeighbors) { // Any live cell with more than three neighbors dies //Act string newState = LifeRules.GetNewState(currentState, numberOfLiveNeighbors); //Assert Assert.AreEqual("dead", newState); }
public void DeadCell_Exactly3LiveNeighbors_Lives() { //Arrange var currentState = CellState.Dead; var liveNeighbors = 3; // Act CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); // Assert Assert.AreEqual(CellState.Alive, newState); }
public void Live_Cell_With_Two_Or_Three_Live_Neighbors_Lives(string currentState, int numberOfLiveNeighbors) { // Any live cell with two or three live neighbors lives //Act string newState = LifeRules.GetNewState(currentState, numberOfLiveNeighbors); //Assert Assert.AreEqual("alive", newState); }
public void DeadCell_MoreThan3LiveNeighbors_StaysDead([Range(4, 8)] int liveNeighbors) { //Arrange var currentState = CellState.Dead; //Act CellState newState = LifeRules.GetNewState(currentState, liveNeighbors); //Assert Assert.That(newState, Is.EqualTo(CellState.Dead)); }
public void LiveNeighbors_LessThan0_ThrowArgumentOutOfRangeException() { var currentState = CellState.Alive; var liveNeighbors = -1; Assert.Throws( Is.TypeOf <ArgumentOutOfRangeException>() .And.Property("ParamName") .EqualTo("liveNeighbors"), () => LifeRules.GetNewState(currentState, liveNeighbors)); }
public void CurrentState_When2_ThrowArgumentException() { var currentState = (CellState)2; var liveNeighbors = 0; CellState newState; //Assert.That(() => newState = LifeRules.GetNewState(currentState, liveNeighbors), // Throws.TypeOf<ArgumentOutOfRangeException>()); Assert.Throws <ArgumentOutOfRangeException>(() => newState = LifeRules.GetNewState(currentState, liveNeighbors)); }
public void DeadCell_ExactlyThreeLiveNeighbors_Lives() { // Arrange const CellState currentState = CellState.Dead; const int liveNeighbors = 3; // Act var result = LifeRules.GetNewState(currentState, liveNeighbors); // Assert Assert.Equal(CellState.Alive, result); }