예제 #1
0
        public void CombineHalfBlockTest(Color firstColor, Color secondColor, Color expectedColor)
        {
            HalfBlock halfBlock = new HalfBlock(new HalfBlockColor(firstColor));
            HalfBlock second    = new HalfBlock(new HalfBlockColor(secondColor));

            halfBlock.CombineHalfBlock(second);

            Color result = halfBlock.CalculateUnityColor();

            Assert.AreEqual(expectedColor, result);
        }
예제 #2
0
        public void CombineHalfBlock(HalfBlock other)
        {
            HalfBlockDecorator currentWrappedObject = this.wrappedObject;

            while (currentWrappedObject.wrappedObject != null)
            {
                currentWrappedObject = currentWrappedObject.wrappedObject;
            }
            currentWrappedObject.wrappedObject = other.wrappedObject;
            other.wrappedObject = currentWrappedObject.wrappedObject;
        }
예제 #3
0
        public void CalculateUnityColorTest(Color firstColor, Color secondColor, Color expectedColor)
        {
            HalfBlock halfBlock = new HalfBlock();

            HalfBlockColorDecorator first  = new HalfBlockColorDecorator(new HalfBlockColor(firstColor));
            HalfBlockColorDecorator second = null;

            if (!secondColor.Equals(new Color()))
            {
                second = new HalfBlockColorDecorator(new HalfBlockColor(secondColor));
            }
            halfBlock.wrappedObject = first;
            first.wrappedObject     = second;

            Color result = halfBlock.CalculateUnityColor();

            Assert.AreEqual(expectedColor, result);
        }