public void ImageProcessor_Can_GetDefaultImage(int height, int width)
        {
            var defaultImage = _imageProcessor.GetDefaultImage(height, width);

            Assert.NotNull(defaultImage);
            Assert.Equal(height * width, defaultImage.Length);
        }
Beispiel #2
0
        protected override async Task ReadStateAsync()
        {
            await base.ReadStateAsync();

            _chunkKey = this.GetPrimaryKey();
            (_battleId, _xChunkIndex, _yChunkIndex) = GuidExtensions.ToKeys(_chunkKey);

            var battle = await _apiClient.GetBattleAsync(_battleId);

            _chunkWidth  = battle.Settings.ChunkWidth;
            _chunkHeight = battle.Settings.ChunkHeight;

            if (State.Image == null)
            {
                _pixelsCache = _imageProcessor.GetDefaultImage(_chunkHeight, _chunkWidth);

                State.ChangeIndex = 0;
                State.Image       = _imageProcessor.GetBytesFromPixels(_pixelsCache, _chunkHeight, _chunkWidth);
            }
            else
            {
                _pixelsCache = _imageProcessor.GetPixelsFromBytes(State.Image, _chunkHeight, _chunkWidth);
            }
        }