rhino-mocks

Beginner Rhino Mock problem

So I'm new to rhino mocks and I'm trying to get it going in a MVP patterned project I'm on. So I've got an interface representing my View and a class for my Presenter like so: public interface IView { string SomeData { get; set; } } public class Presenter { public IView View { get; set; } public void Init(IView view) { this.V...

How to Mock Indexed Property with Rhino Mocks ?

How can I Mock Indexed Property with Rhino Mocks ? ...

Mocking Objects Containing SubObjects With Rhino Mocks

Hi, Assuming an IMouvement Object which contains some subobjects like ITache, IStockPalette. public interface IMouvement : IObjectBase<Guid> { ITache Tache { get; set; } IStockPalette StockPalOrigine { get; set; } } How can I Mock this using Rhino Mocks ? Assuming this test, what's wrong with this ? [TestMethod] pub...

How-To Mock WCF Services ?

How-to Mock WCF Services Proxies with Rhino Mocks ? ...

Mocking ConfigurationCollection

Hi, How can I Mock ConfigurationCollection with Rhino Mocks. I need to create an Expected ConfigurationCollection which contains 1 element in order to test if me Configuration contains that element. Thanks. Note : My ConfigurationCollection inherits from IEnumerable. public interface ICapalConfiguration { ICapalRepositoryConfigu...

Why do Rhino.Mocks and Moq say that Bar is a non-overridable member?

Could someone explain why both tests using the latest versions of Moq and Rhino.Mocks frameworks fail complaining that Bar is not a virtual/overridable method: public interface IFoo { string Bar(); } public class Foo : IFoo { public string Bar() { return "Bar"; } } [TestMethod] public void MoqTest() { var f...

What are the differences between mocks and stubs on Rhino Mocks?

I haven't play enough with this and usually use mocks, but I wonder what are the differences between this two and when to use one or the other on Rhino Mocks. Update: I also found the answer to my question in Ayende's words: The difference between stubs and mocks You can get the actual definition of the these terms in this article: Mo...

What is Rhino Mocks Repeat ?

What is Rhino Mocks Repeat ? Repeat.Any(); Repeat.Once(); What does it mean and how it works ? ...

Rhino Mocks, void and properties

Just starting out with Rhino Mocks and im having a very simple problem, how do I mock a class with a void which sets a property? class SomeClass : ISomeClass { private bool _someArg; public bool SomeProp { get; set; } public SomeClass(bool someArg) { _someArg = someArg; } public void SomeMethod() ...

Rhino Mocks - Stub .Expect vs .AssertWasCalled

Disclosure: I am a Rhino Mocks n00b! OK, I know there has been a lot of confusion over the new AAA syntax in Rhino Mocks, but I have to be honest, from what I have seen so far, I like. It reads better, and saves on some keystrokes. However, I am having problems getting my head around this, and seek some advice to make sure I am not mis...

How do I combine two interfaces when creating mocks?

We are using Rhino Mocks to perform some unit testing and need to mock two interfaces. Only one interface is implemented on the object and the other is implemented dynamically using an aspect-oriented approach. Is there an easy way to combine the two interfaces dynamically so that a mock can be created and the methods stubbed for both in...

Stubbing property getter prior to method on the same object - Rhino.Mocks 3.5

I have a possible bug scenario for Rhino.Mocks 3.5 here: http://groups.google.com/group/RhinoMocks/browse_thread/thread/b38d09b276e66ec7 Has anyone knows what's the issue? ...

Is there a way to decide when a RhinoMocks mock starts recording?

As I understand it, a mock object created with RhinoMocks enter the recording state directly when it is created, and then you call Replay() to enter the replay state. I would like to manually decide when the mock object starts recording, or be able to pause the recording. Would that be possible in RhinoMocks? Thanks /Erik ...

Rhino Mocks, returning a different result each time stubbed method is executed

In this example the .Stub returns a new memory stream. The same memory stream is returned both times. What I want is a new memory stream every time. My question is, how do I change the .Stub in order to make this test pass? [TestMethod] public void Meh() { var mockFileSystem = MockRepository.GenerateMock<IFileSystemService>(); ...

Rhino Mocks - Verify Property Set when Property has no Get

If you have a property: public class Fred { public string UserName { set { userName=value; } } } how do you use Rhino Mocks to check that fred= new Fred(); fred.UserName="Jim"; is called. Expect.Call(mockFred.UserName).SetPropertyWithArgument("Jim"); does not compile. ...

Mocking Static methods using Rhino.Mocks

Is it possible to mock a static method using Rhino.Mocks ? if Rhino does not support this.. Is there a pattern or something which would let me accomplish the same ? ...

Returning empty lists as default with Rhino Mocks

I think it's a good practise to always return empty lists or arrays instead of null when a method comes up with no results to avoid null checks in the code. Because Rhino Mocks returns the default value for an object, which is null for lists and arrays, a lot of times I have to either add the null checks back in or setup the mocks with...

How to mock a method (custom behavior) with Rhino Mocks in VB.NET

How can I mock one method with RhinoMocks in VB.Net? The reference I found is in C#: Expect.Call(delegate{list.Add(0);}).IgnoreArguments() .Do((Action<int>)delegate(int item) { if (item < 0) throw new ArgumentOutOfRangeException(); }); SharpDevelop converts this to: Expect.Call(Function() Do list.Add(0) ...

Seting up configuration for Spring.Net and Rhino Mocks for static GenerateMock<>

I am having trouble setting up the configuration of Spring.Net so that I can use Rhino Mocks to generate a mock object. I realise that GenerateMock is a static method and so I need to use the factory-method in the config, but I just can't get it to work. This is the configuration I am using:   <object id="exampleObject"    type...

Failing NUnit test when running through CC.NET

The solution for this error has escaped me for several days now, and it is time to come here for help. The short version is, I have a unit test that fails on the build server but no other environment. The method I'm testing is an extension method for ILog in log4net. The purpose of this extension method is to make a debug log of the cur...