public void RegionCreateExistingChunkTest() { IRegion region = new Region(_worldMapMock.Object, 0, 0, _serviceProvider); IChunk chunk = region.AddChunk(0, 0); Assert.Throws <InvalidOperationException>(() => region.AddChunk(0, 0)); }
public void RegionGetBlockTest(int x, int y, int z) { var region = new Region(_worldMapMock.Object, 0, 0, _serviceProvider); region.AddChunk(0, 0); region.AddChunk(1, 0); region.AddChunk(0, 1); region.AddChunk(1, 1); IBlock block = region.GetBlock(x, y, z); Assert.NotNull(block); Assert.IsType <Block>(block); Assert.Equal(BlockType.Air, block.Type); Assert.True(block.IsAir); }
public void RegionCheckIfContainsChunkTest() { var region = new Region(_worldMapMock.Object, 0, 0, _serviceProvider); region.AddChunk(0, 0); Assert.True(region.ContainsChunk(0, 0)); }
public void RegionGetExistingChunkTest() { var region = new Region(_worldMapMock.Object, 0, 0, _serviceProvider); IChunk chunk = region.AddChunk(0, 0); Assert.NotNull(chunk); Assert.Same(chunk, region.GetChunk(0, 0)); }
public void RegionCreateChunkTest() { IRegion region = new Region(_worldMapMock.Object, 0, 0, _serviceProvider); IChunk chunk = region.AddChunk(0, 0); Assert.NotNull(chunk); Assert.IsType <Chunk>(chunk); Assert.Equal(0, chunk.X); Assert.Equal(0, chunk.Z); Assert.NotEmpty(region.Chunks.Where(x => x is not null)); }
public void RegionSetBlockAtChunkTest(int x, int y, int z, BlockType blockType) { var region = new Region(_worldMapMock.Object, 0, 0, _serviceProvider); region.AddChunk(0, 0); region.AddChunk(1, 0); region.AddChunk(0, 1); region.AddChunk(1, 1); IBlock placedBlock = region.SetBlock(blockType, x, y, z); IBlock block = region.GetBlock(x, y, z); Assert.NotNull(placedBlock); Assert.NotNull(block); Assert.Equal(placedBlock, block); Assert.IsType <Block>(placedBlock); Assert.IsType <Block>(block); Assert.Equal(blockType, block.Type); Assert.False(block.IsAir); }