public void TestLoadedTerritoriesAreUnique() { var earth = BoardBuilder.LoadNewTerritories(); var rnd1 = _random.Next(0, 41); var rnd2 = _random.Next(0, 41); while (rnd1 == rnd2) { rnd2 = _random.Next(0, 41); } var territory1 = earth.Territories[rnd1]; var territory2 = earth.Territories[rnd2]; Assert.AreNotSame(territory1, territory2); }
public void Builder_AssignNonExistingComponent_InputIgnored() { // Arrange var builder = new BoardBuilder(); // Act var varName = "InputNode"; var compName = "Non-existing-component"; builder.AddComponent(varName, compName); // Assert var components = builder.Build().Components; Assert.IsTrue(!components.ContainsKey(varName)); }
public void Builder_LinkAToNonExisting_NothingIsLinked() { // Arrange var builder = new BoardBuilder(); // Act var varName1 = "A"; var compName = "Input"; builder.AddComponent(varName1, compName); var varName2 = "B"; builder.LinkList(varName1, new[] { varName2 }); // Assert var components = builder.Build().Components; var node1 = components[varName1]; Assert.IsTrue(node1.Next.Count == 0); }
public void Builder_AssignInput_InputExists() { // Arrange var builder = new BoardBuilder(); // Act var varName = "InputNode"; var compName = "Input"; builder.AddComponent(varName, compName); // Assert var components = builder.Build().Components; Assert.IsTrue(components.ContainsKey(varName)); var node = components[varName]; Assert.IsInstanceOfType(node, typeof(Input)); }
public void Builder_AssignInputNonExistingValue_InputExistsWithLowValue() { // Arrange var builder = new BoardBuilder(); // Act var varName = "InputNode"; var compName = "Input"; var value = "Non-Existing"; builder.AddComponent(varName, compName, value); // Assert var components = builder.Build().Components; Assert.IsTrue(components.ContainsKey(varName)); var node = components[varName]; Assert.IsInstanceOfType(node, typeof(Input)); Assert.AreEqual(Bit.LOW, node.Value); }
public void Builder_AssignAlreadyExistingVariable_OverwriteComponent() { // Arrange var builder = new BoardBuilder(); // Act var varName = "Node1"; var compName = "Input"; builder.AddComponent(varName, compName); var compName2 = "Probe"; builder.AddComponent(varName, compName2); // Assert var components = builder.Build().Components; Assert.IsTrue(components.ContainsKey(varName)); var node = components[varName]; Assert.IsInstanceOfType(node, typeof(Probe)); }
//------------------------DATA------------------------------ private BoardPosition[,] BuildBlankBoard() { IBoardBuilder boardBuilder = new BoardBuilder(); return(boardBuilder.BuildBoard()); }
public void TestAllCardsLoad() { var cards = BoardBuilder.LoadCards(_random); Assert.AreEqual(44, cards.Count); }
public void TestAllTerritoriesLoad() { var territories = BoardBuilder.LoadNewTerritories(); Assert.AreEqual(42, territories.Territories.Count); }