public void AddToEmptySpace() { // Given var space = new HexSpace <Item>(); // When var payload = new Item(); var h = space.Add(payload); // Then space.Contains(h).Should().BeTrue(); space.GetPayload(h).Should().Be(payload); space.Count.Should().Be(1); }
public void NearestHexes_from_center() { // Given var space = new HexSpace <Item>(); var payloads = Enumerable.Range(0, 7).Select(i => new Item()); var hexes = new List <Hex>(); foreach (var payload in payloads) { space.Add(payload); } // When var nearestHexes = space.GetNearestHexes(new Hex(0, 0)); // Then nearestHexes.Should().NotBeEmpty(); nearestHexes.Should().HaveCount(6); }
public void FillUpFirstTwoRings() { // Given var space = new HexSpace <Item>(); // When var payloads = Enumerable.Range(0, 7).Select(i => new Item()); var hexes = new List <Hex>(); foreach (var payload in payloads) { space.Add(payload); } // Then space.Count.Should().Be(payloads.Count()); hexes.ForEach(h => { var p = space.GetPayload(h); payloads.Should().Contain(p); }); }