public void InitializeGrid() { groupPattern = Substitute.For <IGroupPattern>(); rotationMock = new List <Coord[]>() { new Coord[] { new Coord(0, 0), new Coord(0, -1), new Coord(1, 0), new Coord(-1, 0), }, new Coord[] { new Coord(0, 0), new Coord(-1, 0), new Coord(0, -1), new Coord(0, 1), }, new Coord[] { new Coord(0, 0), new Coord(0, 1), new Coord(-1, 0), new Coord(1, 0), }, new Coord[] { new Coord(0, 0), new Coord(1, 0), new Coord(0, 1), new Coord(0, -1), }, }; groupPattern.Patterns.Returns(rotationMock); groupPatternList = new List <IGroupPattern>(); groupPatternList.Add(groupPattern); groupFactory = new GroupFactory(blockFactory, groupPatternList); gridFactory = new GridFactory(setting, groupFactory); // create grid grid = gridFactory.Create(); grid.NewGame(); blockPattern = Substitute.For <IBlockPattern>(); blockTypeMock = new BlockType[] { BlockType.One, BlockType.Six, BlockType.Three, BlockType.Five, }; blockPattern.Types.Returns(blockTypeMock); group = groupFactory.Create(setting, blockPattern, groupPattern); }
public void InitializeGrid() { groupPattern = Substitute.For<IGroupPattern>(); rotationMock = new List<Coord[]>() { new Coord[] { new Coord(0, 0), new Coord(0, -1), new Coord(1, 0), new Coord(-1, 0), }, new Coord[] { new Coord(0, 0), new Coord(-1, 0), new Coord(0, -1), new Coord(0, 1), }, new Coord[] { new Coord(0, 0), new Coord(0, 1), new Coord(-1, 0), new Coord(1, 0), }, new Coord[] { new Coord(0, 0), new Coord(1, 0), new Coord(0, 1), new Coord(0, -1), }, }; groupPattern.Patterns.Returns(rotationMock); groupPatternList = new List<IGroupPattern>(); groupPatternList.Add(groupPattern); groupFactory = new GroupFactory(blockFactory, groupPatternList); gridFactory = new GridFactory(setting, groupFactory); // create grid grid = gridFactory.Create(); grid.NewGame(); blockPattern = Substitute.For<IBlockPattern>(); blockTypeMock = new BlockType[] { BlockType.One, BlockType.Six, BlockType.Three, BlockType.Five, }; blockPattern.Types.Returns(blockTypeMock); group = groupFactory.Create(setting, blockPattern, groupPattern); }
public IGroup Create(ISetting setting, IBlockPattern blockPattern, IGroupPattern groupPattern) { IGroup group = new Group(setting); for (int i = 0; i < groupPattern.Patterns[0].Length; i++) { IBlock block = _blockFactory.Create(setting, blockPattern.Types[i], groupPattern.Patterns[0][i]); group.AddBlock(block); } group.SetPattern(groupPattern.Patterns); return(group); }
public void ShouldCreateGroupFromGroupPattern() { IGroup group = groupFactory.Create(setting, blockPattern, groupPattern); group.SetLocation(new Coord(0, 0)); foreach (Coord coord in locationMock[0]) { group.ChildrenLocation.Contains(coord); } int[] numbers = new int[] { 3, 1, 5 }; IBlockPattern blockPatternTwo = BlockPattern.CreateFromNumbers(numbers); IGroup groupTwo = groupFactory.Create(setting, blockPatternTwo, groupPattern); for (int i = 0; i < numbers.Length; i++) { Assert.AreEqual((BlockType)numbers[i] - 1, groupTwo.Children[i].BlockType); } }
public void Init() { blockPattern = Substitute.For <IBlockPattern>(); blockTypeMock = new BlockType[] { BlockType.Two, BlockType.Four, BlockType.Seven, }; blockPattern.Types.Returns(blockTypeMock); groupPattern = Substitute.For <IGroupPattern>(); locationMock = new List <Coord[]>() { new Coord[] { new Coord(0, 0), new Coord(0, 1), new Coord(1, 0), }, new Coord[] { new Coord(0, 0), new Coord(1, 0), new Coord(0, -1), }, new Coord[] { new Coord(0, 0), new Coord(0, -1), new Coord(-1, 0), }, new Coord[] { new Coord(0, 0), new Coord(-1, 0), new Coord(0, 1), }, }; groupPattern.Patterns.Returns(locationMock); }
public void Init() { blockPattern = Substitute.For<IBlockPattern>(); blockTypeMock = new BlockType[] { BlockType.Two, BlockType.Four, BlockType.Seven, }; blockPattern.Types.Returns(blockTypeMock); groupPattern = Substitute.For<IGroupPattern>(); locationMock = new List<Coord[]>() { new Coord[] { new Coord(0, 0), new Coord(0, 1), new Coord(1, 0), }, new Coord[] { new Coord(0, 0), new Coord(1, 0), new Coord(0, -1), }, new Coord[] { new Coord(0, 0), new Coord(0, -1), new Coord(-1, 0), }, new Coord[] { new Coord(0, 0), new Coord(-1, 0), new Coord(0, 1), }, }; groupPattern.Patterns.Returns(locationMock); }
public IGroup Create(ISetting setting, IBlockPattern blockPattern, IGroupPattern groupPattern) { throw new System.NotImplementedException(); }
public bool AddGroupToTheGrid(IBlockPattern blockPattern, IGroupPattern groupPattern) { IGroup group = _groupFactory.Create(_setting, blockPattern, groupPattern); return(_grid.AddGroup(group)); }
public bool AddGroupToTheGrid(IBlockPattern blockPattern, IGroupPattern groupPattern) { IGroup group = _groupFactory.Create(_setting, blockPattern, groupPattern); return _grid.AddGroup(group); }