>
> private readonly IQueryable<Setting> SaveDbSettings = new List<Setting>
>
>             {
>
>                 new Setting {Key = SomethingKey, SettingTypeID = (int) 
>> AppType, Value = HostVal},
>
>                 new Setting {Key = ShowSomethingKey, SettingTypeID = (int) 
>> AppType, Value = ShowSomethingValue},
>
>                 new Setting {Key = KeyBitLengthKey, SettingTypeID = 
>> (int)AppType, Value = KeyBitLengthValue}
>
>             }.AsQueryable();
>
>  

> private void SetupSaveSettingsModel()
>
>         {
>
>             AutoMocker.Get<IRepository<Setting>>().Stub(x => 
>> x.All()).Return(SaveDbSettings);
>
>             AutoMocker.Get<ICacher<Setting>>()
>
>                 .Stub(x => x.AddToCache(SettingsCachePrefix + AppType, 
>> SaveDbSettings.Where(y => y.SettingTypeID == (int)AppType).ToList()));
>
>             AutoMocker.Get<ICacher<Setting>>()
>
>                 .Stub(x => x.GetListFromCache(SettingsCachePrefix + 
>> AppType))
>
>                 .Return(SaveDbSettings.Where(y => y.SettingTypeID == 
>> (int)AppType).ToList());
>
>         }
>
>       
>
> [Test]
>
>         public void SaveSettings_ShouldUpdateSettingsViaAddCollection()
>
>         {
>
>             SetupSaveSettingsModel();
>
>
>>             AutoMocker.ClassUnderTest.SaveSettings(SaveSettingModel);
>
>
>>             //AutoMocker.Get<IRepository<Setting>>().AssertWasCalled(x => 
>> x.UpdateCollection(Arg<IQueryable<Setting>>.List.Element(0, 
>> Property.Value("Key", HostKey))));
>
>             AutoMocker.Get<IRepository<Setting>>().AssertWasCalled(x => 
>> x.UpdateCollection(SaveDbSettings), opt => opt.IgnoreArguments());
>
>         }
>
>
What is the syntax for getting this to pass? Unless I IgnoreArguments() it 
fails, I'm assuming the List<Object> are not truly equal somehow. So I 
tried to the commented out line, but to no avail. I'm pretty lost on what I 
should be doing under this pattern, but it's pretty important because the 
guy who wrote our repository layer didn't add any code for saving lists, so 
we'd have to go _serviceLayer.Save(singleObject) like 20 times just to 
"save a collection". Our unit tests contain no examples of how you assert 
than a method like this is actually called, and get it to pass WITHOUT 
IgnoreArguments(). I'm trying to add that to our codebase, but it's been 
giving me fits. Any tips? Much appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to