I fixed this over lunch and just needed some help with Git...I send a pull
request over to Ayende so after he pulls it in, the fix will be in the trunk

Tim

On Fri, Sep 11, 2009 at 12:37 AM, kurtharriger <[email protected]>wrote:

>
> Arg.Is.Equal type conversion
>
>
> Here is a failing test for an issue that tripped me up for awhile.
> The problem is that although I'm using Arg<long> userId is inferred by
> the compiler to be an Int32 not Int64.
> Could be nice enhancement to carry the type parameter through to
> Is.Equal(T obj)  or at least perhaps throw an exception.
>
>
> [TestFixture]
>    public class ArgConstraintTest
>    {
>
>        [Test]
>        public void ConvertArgEqualParamToCorrectType()
>        {
>            const string user = "test";
>            var userId = 1;  // inferred as Int32
>            var crossReferenceService =
> MockRepository.GenerateStub<ITestService>();
>            crossReferenceService.Stub(x => x.GetUser
> (Arg<long>.Is.Equal(userId))).Return(user);
>            var value = crossReferenceService.GetUser(userId);
>            Assert.That(value, Is.EqualTo(user));
>
>        }
>        public interface ITestService
>        {
>            string GetUser(long id);
>        }
>    }
> >
>


-- 
Tim Barcz
Microsoft ASPInsider
http://timbarcz.devlicio.us
http://www.twitter.com/timbarcz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to