Example #1
0
        public void Draw_NoImage_NothingIsDrawn()
        {
            var testObj = CreateEmptyBox();
            var spriteBatch = new SpriteBatchMock();

            testObj.Draw(spriteBatch);

            Assert.IsEmpty(spriteBatch.DrawnObjects);
        }
        public void Draw_NoForeground_NoForegroundDrawn()
        {
            var foregroundComponent = new GraphicComponentMock();
            var testComponent = CreateComponent(foreground: foregroundComponent);
            var batch = new SpriteBatchMock();
            testComponent.SetCoordinates(100, 100, 500, 500);

            testComponent.Foreground = null;
            testComponent.Draw(batch);

            Assert.False(foregroundComponent.WasDrawn);
        }
Example #3
0
        public void Draw_UnselectedDraw_ArrowNotDrawn(float x, float y, float width, float height)
        {
            SpriteBatchMock spriteBatch = new SpriteBatchMock();
            var arrow = new GraphicComponentMock();
            var textBox = new TextGraphicComponentMock();

            var item = CreateItemBox(arrow, textBox);
            item.SetCoordinates(x, y, width, height);

            item.Draw(spriteBatch);

            Assert.False(arrow.WasDrawn);
        }
Example #4
0
        public void Draw_SelectedDraw_ArroLeftOfText(float x, float y, float width, float height)
        {
            SpriteBatchMock spriteBatch = new SpriteBatchMock();
            var arrow = new GraphicComponentMock();
            var textBox = new TextGraphicComponentMock();

            var item = CreateItemBox(arrow, textBox);
            item.SetCoordinates(x, y, width, height);
            item.Select();

            item.Draw(spriteBatch);

            Assert.LessOrEqual(arrow.XPosition, textBox.XPosition);
        }
        public void Draw_Call_DrawComponentCalled()
        {
            var componentMock = CreateComponentWithoutInvalidation();
            var time = new GameTime();
            var spriteBatchStub = new SpriteBatchMock();

            componentMock.Object.Draw(time, spriteBatchStub);
            componentMock.Protected().Verify("DrawComponent", Times.Once(), time, spriteBatchStub);
        }