public void Apply_SetsStatusToDead_WhenCalled() { // Arrange CellInformation info = CreateCellInformation(); UnderpopulationRule sut = CreateSut(); // Act sut.Apply(info); // Assert info.Status.ShouldEqual(Cell.Status.Dead); }
public void Priority_ReturnsInteger_WhenCalled() { // Arrange CellInformation info = CreateCellInformation(); UnderpopulationRule sut = CreateSut(); // Act sut.Apply(info); // Assert sut.Priority.ShouldEqual(1); }
public void Initialize_AddsLessThanRule_WhenCalled() { // Arrange CellInformation info = CreateCellInformation(); UnderpopulationRule sut = CreateSut(); // Act sut.Initialize(info); // Assert sut.GetConditions().Last().ShouldBeInstanceOf <IsLessThan>(); }
public void Initialize_AddsConditions_WhenCalled() { // Arrange CellInformation info = CreateCellInformation(); UnderpopulationRule 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); UnderpopulationRule sut = CreateSut(); sut.Initialize(info); // Act bool actual = sut.IsValid(); // Assert Assert.Equal(expected, actual); }
public void Should_Test_UnderpopulationRule_Returns_False() { // arrange var fileInput = new FileReader(); var grid = new Universe(fileInput); var rule = new UnderpopulationRule(grid); grid.SetUpGrid(Constants.GridLength, Constants.GridWidth); grid.Initialise(); var col = 1; var row = 1; var expected = false; // act var result = rule.Check(row, col); // assert Assert.Equal(expected, result); }
public void Should_Test_UnderpopulationRule(int cellX, int cellY, bool expected) { // arrange var fileInput = new FileReader(); var grid = new Universe(fileInput); var rule = new UnderpopulationRule(grid); grid.SetUpGrid(Constants.GridLength, Constants.GridWidth); grid.Initialise(); grid.SwitchCellState(0, 0); grid.SwitchCellState(0, 1); grid.SwitchCellState(0, 2); grid.SwitchCellState(1, 0); grid.SwitchCellState(1, 2); grid.SwitchCellState(2, 0); grid.SwitchCellState(2, 1); // act var result = rule.Check(cellX, cellY); // assert Assert.Equal(expected, result); }
private UnderpopulationRule CreateSut() { var underpopulationRule = new UnderpopulationRule(); return(underpopulationRule); }