Exemplo n.º 1
0
            public void RemoveAtFrame_CanRemoveFrameZeroIfMultipleFramesExist()
            {
                var collection = new ImageFrameCollection <Rgba32>(
                    this.Image,
                    new[] { new ImageFrame <Rgba32>(Configuration.Default, 10, 10), new ImageFrame <Rgba32>(Configuration.Default, 10, 10) });

                collection.RemoveFrame(0);
                Assert.Equal(1, collection.Count);
            }
            public void RemoveAtFrame_ThrowIfRemovingLastFrame()
            {
                using var imageFrame = new ImageFrame <Rgba32>(Configuration.Default, 10, 10);
                var collection = new ImageFrameCollection <Rgba32>(
                    this.Image,
                    new[] { imageFrame });

                InvalidOperationException ex = Assert.Throws <InvalidOperationException>(
                    () => collection.RemoveFrame(0));

                Assert.Equal("Cannot remove last frame.", ex.Message);
            }
        public void RemoveAtFrame_ThrowIfRemovingLastFrame()
        {
            var collection = new ImageFrameCollection <Rgba32>(this.image, new[] {
                new ImageFrame <Rgba32>(10, 10)
            });

            InvalidOperationException ex = Assert.Throws <InvalidOperationException>(() =>
            {
                collection.RemoveFrame(0);
            });

            Assert.Equal("Cannot remove last frame.", ex.Message);
        }