+1

On Fri, Jun 26, 2009 at 12:45 PM, isaiah perumalla <
[email protected]> wrote:

> for this i found its best to simply do an integration test against a db.
> you can easily do it using a light weight in process db like sqlLite or Sql
> CE
>
> Isaiah
>
>
> On Fri, Jun 26, 2009 at 12:10 PM, Berryl Hesh <[email protected]> wrote:
>
>>
>> Hello:
>>
>> I would like to test an NHibernate custom type without setting up a db
>> and a session if I can. To test the NullSafeGet method, I need an
>> IDataReader with values. My last attempt to do that (below), I'm
>> trying to use Expect.Do(). I'm not sure if that's a good way to do
>> this though, or where to trigger something to make it work.
>>
>> Cheers,
>> Berryl
>>
>>    [Test]
>>        public void NullSafeGet()
>>        {
>>            var t = new TimePeriodUserType();
>>            var expected = DateRange.AllDay();
>>            var names = new[] {"START", "END"};
>> ///////////////
>>            var rs = MockRepository.GenerateStub<IDataReader>();
>>            rs.Stub(x => x.GetValues(null)).IgnoreArguments().Do(new
>> Func<object[], int>(_testData));
>> /////////////
>>            var session =
>> MockRepository.GenerateStub<ISessionImplementor>();
>>            var owner = MockRepository.GenerateStub<object>();
>>
>>            Assert.That(t.NullSafeGet(rs, names, session, owner),
>> Is.EqualTo(expected));
>>        }
>>
>> private static int _testData(object[] fields)
>>        {
>>            var range = DateRange.AllDay();
>>            fields[0] = range.Start.ToString();
>>            fields[1] = range.End.ToString();
>>            return 2;
>>        }
>>
>>
>>
>>
>
>
> --
> Isaiah Perumalla
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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