Esempio n. 1
0
        public void VoidMethods()
        {
            _mock.Expects.One.Method(_ => _.MethodVoid()).Comment("");
            _mock.Expects.One.Method(_ => _.MethodVoid <string>("10")).With(Is.StringContaining("10")).Comment("");

            _mock.MockObject.MethodVoid();
            _mock.MockObject.MethodVoid <string>("10");
        }
        /// <summary>
        ///   Lets the renderer draw the button and verifies that the button used
        ///   the skin elements from the expected state
        /// </summary>
        /// <param name="expectedState">
        ///   Expected state the skin elements should be using
        /// </param>
        private void drawAndExpectState(string expectedState)
        {
            // Make sure the renderer draws at least a frame and the button's text
            MockedGraphics.Expects.One.Method(m => m.DrawElement(null, RectangleF.Empty)).With(
                Is.StringContaining(expectedState), Is.Anything
                );
            MockedGraphics.Expects.One.Method(m => m.DrawString(null, RectangleF.Empty, null)).With(
                Is.StringContaining(expectedState), Is.Anything, Is.EqualTo("Test")
                );

            // Let the renderer draw the button into the mocked graphics interface
            renderer.Render(this.button, MockedGraphics.MockObject);

            // And verify the expected drawing commands were issues
            Mockery.VerifyAllExpectationsHaveBeenMet();
        }
        /// <summary>
        ///   Lets the renderer draw the slider and verifies that the slider used
        ///   the skin elements from the expected state
        /// </summary>
        /// <param name="expectedState">
        ///   Expected state the skin elements should be using
        /// </param>
        private void drawAndExpectState(string expectedState)
        {
            // Make sure the renderer draws at least two frames
            MockedGraphics.Expects.One.Method(
                m => m.DrawElement(null, RectangleF.Empty)
                ).WithAnyArguments();
            MockedGraphics.Expects.One.Method(m => m.DrawElement(null, RectangleF.Empty)).With(
                Is.StringContaining(expectedState), Is.Anything
                );

            // Let the renderer draw the slider into the mocked graphics interface
            renderer.Render(this.slider, MockedGraphics.MockObject);

            // And verify the expected drawing commands were issues
            Mockery.VerifyAllExpectationsHaveBeenMet();
        }