Ejemplo n.º 1
0
        public void WithAutomaticDimensionsFromLayers_ReturnsCorrectValue_WhenCalled(LayerTestCase layerTestsCase)
        {
            // arrange
            var sut    = new Psb.Infrastructure.Builders.Implementations.PsdFileBuilder();
            var layers = layerTestsCase
                         .LayersRectangles
                         .Select(lt =>
            {
                var layer = new Moq.Mock <Domain.ILayer>();
                layer
                .SetupGet(l => l.Rectangle)
                .Returns(lt);

                return(layer.Object);
            });

            var layerList = new Moq.Mock <Domain.ILayerList>();

            layerList
            .Setup(ll => ll.GetEnumerator())
            .Returns(() => layers.GetEnumerator());

            sut.Layers = layerList.Object;

            // act
            sut.WithAutomaticDimensionsFromLayers();

            var result = sut.Build();

            // assert
            Assert.AreEqual(layerTestsCase.ExpectedWidth, result.Width);
            Assert.AreEqual(layerTestsCase.ExpectedHeight, result.Height);
        }
Ejemplo n.º 2
0
        public void WithDepth_ShouldSetPsdDepth_WhenCalled(Psb.Domain.NumberOfBitsPerChannel numberOfBitsPerChannel)
        {
            // arrange
            var sut = new Psb.Infrastructure.Builders.Implementations.PsdFileBuilder();

            // act
            sut.WithChannelDepth(numberOfBitsPerChannel);
            var result = sut.Build();

            // assert
            Assert.AreEqual(numberOfBitsPerChannel, result.Depth);
        }
Ejemplo n.º 3
0
        public void WithColorMode_ShouldSetPsdColorMode_WhenCalled(Psb.Domain.ColorMode colorMode)
        {
            // arrange
            var sut = new Psb.Infrastructure.Builders.Implementations.PsdFileBuilder();

            // act
            sut.WithColorMode(colorMode);
            var result = sut.Build();

            // assert
            Assert.AreEqual(colorMode, result.ColorMode);
        }
Ejemplo n.º 4
0
        public void WithHeight_ShouldSetPsdFileHeight_WhenCalled()
        {
            // arrange
            const uint height = 0xBAD0;

            var sut = new Psb.Infrastructure.Builders.Implementations.PsdFileBuilder();

            // act
            sut.WithHeight(height);
            var result = sut.Build();

            // assert
            Assert.AreEqual(height, result.Height);
        }
Ejemplo n.º 5
0
        public void WithWidth_ShouldSetPsdFileWidth_WhenCalled()
        {
            // arrange
            const uint width = 0xBAD0;

            var sut = new Psb.Infrastructure.Builders.Implementations.PsdFileBuilder();

            // act
            sut.WithWidth(width);
            var result = sut.Build();

            // assert
            Assert.AreEqual(width, result.Width);
        }