public void Priority_ReturnsInteger_WhenCalled() { // Arrange CellInformation info = CreateCellInformation(); OvercrowdingRule sut = CreateSut(); // Act sut.Apply(info); // Assert sut.Priority.ShouldEqual(2); }
public void Apply_SetsStatusToDead_WhenCalled() { // Arrange CellInformation info = CreateCellInformation(); OvercrowdingRule sut = CreateSut(); // Act sut.Apply(info); // Assert info.Status.ShouldEqual(Cell.Status.Dead); }
public void Initialize_AddsMoreThanRule_WhenCalled() { // Arrange CellInformation info = CreateCellInformation(); OvercrowdingRule sut = CreateSut(); // Act sut.Initialize(info); // Assert sut.GetConditions().First().ShouldBeInstanceOf <IsMoreThan>(); }
public void Initialize_AddsConditions_WhenCalled() { // Arrange CellInformation info = CreateCellInformation(); OvercrowdingRule sut = CreateSut(); // Act sut.Initialize(info); // Assert sut.GetConditions().Count().ShouldEqual(1); }
public void IsValid_ReturnsTrueOrFalse_ForGivenNeighbours(int neighbours, bool expected) { // Arrange CellInformation info = CreateCellInformation(neighbours); OvercrowdingRule sut = CreateSut(); sut.Initialize(info); // Act bool actual = sut.IsValid(); // Assert Assert.Equal(expected, actual); }
public void Should_Test_OvercrowdingRule_Returns_True() { // arrange var fileInput = new FileReader(); var grid = new Universe(fileInput); var rule = new OvercrowdingRule(grid); grid.SetUpGrid(Constants.GridLength, Constants.GridWidth); grid.Initialise(); var col = 1; var row = 1; var expected = true; // act var result = rule.Check(row, col); // assert Assert.Equal(expected, result); }
public void Should_Test_OvercrowdingRule_Returns_False() { // arrange var fileInput = new FileReader(); var grid = new Universe(fileInput); var rule = new OvercrowdingRule(grid); grid.SetUpGrid(Constants.GridLength, Constants.GridWidth); grid.Initialise(); var col = 1; var row = 1; grid.SwitchCellState(0, 2); // passes for constant == 4 if line commented out grid.SwitchCellState(1, 2); grid.SwitchCellState(2, 0); grid.SwitchCellState(2, 1); grid.SwitchCellState(2, 2); var expected = false; // act var result = rule.Check(row, col); //assert Assert.Equal(expected, result); }
private OvercrowdingRule CreateSut() { var overcrowdingRule = new OvercrowdingRule(); return(overcrowdingRule); }