private void AssertHasCorrectErrorMessageOnUnexpectedInvocation(IGenericSpeaker speaker)
        {
            SkipVerificationForThisTest();

            try
            {
                speaker.Find<int, bool>();

                Assert.Fail("An ExpectationException should have been thrown");
            }
            catch (ExpectationException ex)
            {
                Assert.AreEqual(
                    "unexpected invocation of genericSpeaker.Find<System.Int32, System.Boolean>()\r\nexpectations:\r\n",
                    ex.Message);
            }
        }
        private void AssertHasCorrectErrorMessageOnNotMetExpectation(IGenericSpeaker speaker)
        {
            SkipVerificationForThisTest();

            Expect.Once.On(speaker).Message("Find", typeof (int)).Will(Return.Value(3));

            try
            {
                Mockery.VerifyAllExpectationsHaveBeenMet();

                Assert.Fail("An ExpectationException should have been thrown");
            }
            catch (ExpectationException ex)
            {
                Assert.AreEqual(
                    "not all expected invocations were performed\r\nexpectations:\r\n  expected once, never invoked: genericSpeaker.Find<System.Int32>(any arguments), will return <3>\r\n",
                    ex.Message);
            }
        }
        private void AssertCanMockGenericMethodWithSpecifiedTypeParameter(IGenericSpeaker genericSpeaker)
        {
            const int iValue = 3;
            const string sValue = "test";

            Stub.On(genericSpeaker).Message("Find", typeof (int)).With().Will(Return.Value(iValue));
            Stub.On(genericSpeaker).Message("Find", typeof (string)).Will(Return.Value(sValue));
            Stub.On(genericSpeaker).Message("Find", typeof (ISpeaker), typeof (bool)).Will(
                Return.Value(Mockery.NewInstanceOfRole<ISpeaker>()));

            var s = genericSpeaker.Find<string>();
            var i = genericSpeaker.Find<int>();
            ISpeaker speaker = genericSpeaker.Find<ISpeaker, bool>();

            Assert.AreEqual(iValue, i);
            Assert.AreEqual(sValue, s);
            Assert.IsNotNull(speaker);
        }
        private void AssertCanMockGenericMethodWithUnspecifiedTypeParameter(IGenericSpeaker speaker)
        {
            const int iValue = 3;

            Stub.On(speaker).Message("Find").Will(Return.Value(iValue));

            var i = speaker.Find<int>();

            Assert.AreEqual(iValue, i);
        }
        private void AssertCanMockGenericMethodWithMultipleTypeParameters(IGenericSpeaker genericSpeaker)
        {
            Stub.On(genericSpeaker).Message("Cast", typeof (int), typeof (string)).With(3).Will(Return.Value("three"));

            string s = genericSpeaker.Cast<int, string>(3);

            Assert.AreEqual("three", s);
        }