public void Reset() { maxIntensity = LightValue.MaxIntensity; heightMapYValue = 0; chunkDimensions = new Vector3Int(16, 16, 16); chunkStorage = new Dictionary <Vector3Int, IChunkData>(); lampId = (VoxelTypeID)1; blockerId = (VoxelTypeID)2; voxelTypeManager = Substitute.For <IVoxelTypeManager>(); voxelTypeManager.LastVoxelID.Returns(blockerId); voxelTypeManager.GetLightProperties(Arg.Any <VoxelTypeID>()) .Returns((args) => { var typeId = (VoxelTypeID)args[0]; if (typeId.Equals(lampId)) { return(maxIntensity, maxIntensity); } else if (typeId.Equals(blockerId)) { return(0, maxIntensity); } return(0, 1); }); fullyGenerated = new HashSet <Vector3Int>(); chunkManager = Substitute.For <IChunkManager>(); chunkManager.IsChunkFullyGenerated(Arg.Any <Vector3Int>()) .Returns((args) => { var id = (Vector3Int)args[0]; return(fullyGenerated.Contains(id)); }); var worldLimits = new WorldSizeLimits(false, 0); worldLimits.Initalise(); chunkManager.WorldLimits.Returns(worldLimits); chunkManager.ChunkToWorldPosition(Arg.Any <Vector3Int>()) .Returns((args) => { var chunkId = (Vector3Int)args[0]; return(chunkId * chunkDimensions); }); chunkManager.GetReadOnlyChunkData(Arg.Any <Vector3Int>()) .Returns((args) => { var chunkId = (Vector3Int)args[0]; return(new RestrictedChunkData(GetMockChunkData(chunkId))); }); chunkManager.GetChunkData(Arg.Any <Vector3Int>()) .Returns((args) => { var chunkId = (Vector3Int)args[0]; return(GetMockChunkData(chunkId)); }); chunkManager.ChunkDimensions.Returns(chunkDimensions); IHeightMapProvider heightMapProvider = Substitute.For <IHeightMapProvider>(); heightMapProvider.GetHeightMapForColumn(Arg.Any <Vector2Int>()) .Returns((args) => { return(getFlatHeightMap(heightMapYValue)); }); lightManager = new LightManager(); lightManager.Initialise(voxelTypeManager, chunkManager, heightMapProvider); }