Questions tagged [rhino-mocks]

Rhino.Mocks is a dynamic mock object framework for the .NET platform. Rhino.Mock's purpose is to ease testing by allowing the developer to create mock implementations of custom objects and verify the interactions using unit testing.

Rhino.Mocks is a dynamic mock object framework for the .NET platform. Rhino.Mock's purpose is to ease testing by allowing the developer to create mock implementations of custom objects and verify the interactions using unit testing.

To get started, take a look at the useful manual full of examples for .NET version 3.5. For more information, see the wiki for Rhino.Mocks or the documentation (source code in GitHub).

Installation RhinoMocks can most easily be installed through its NuGet package.

Install-Package RhinoMocks 
1223 questions
0
votes
5 answers

Mocking problem, public function calling private function

I’m having a mocking problem. I know only public methods should be mocked. But what do I do when a private method is called in a public method, and this private method is getting data from a file? I want to mock this private method so I could go on…
Unit09
0
votes
1 answer

Rhino mocks ordered reply, throw exception problem

I'm trying to implement some retry logic if there is an exception in my code. I've written the code and now I'm trying to get Rhino Mocks to simulate the scenario. The jist of the code is the following: class Program { static void…
Richard Nienaber
  • 10,324
  • 6
  • 55
  • 66
0
votes
3 answers

How to ignore calling function in constructor?

I have class that constructor calls a function in constructor. When I create mock for this class then function is called from constructor. I want to block function calling. Can I do it? Sample code: public class Foo { public Foo() { …
Rougher
  • 834
  • 5
  • 19
  • 46
0
votes
1 answer

Testing objects created inside the class

I have a method like this: public void ABC(ViewModeL model) { var dataTable = new DataTable(); dataTable.Columns.Add("column1", typeof(int)); dataTable.Columns.Add("column2", typeof(int)); var…
Infant Dev
  • 1,659
  • 8
  • 24
  • 48
0
votes
1 answer

Mocking Object issue

I am trying to make following mocking var checkComponent = MockRepository.GenerateStub(); checkComponent.Stub(r => r.GetSelector().Select(new Position(3,6,1))).Return(true); I am getting that r.GetSelector() is returning null. Is…
Night Walker
  • 20,638
  • 52
  • 151
  • 228
0
votes
1 answer

Unit testing a Func with Rhino Mocks throwing InvalidCastException with second Expect() invocation

I'm unit testing a class that gets some parameters injected by Autofac. Some of the parameters are Func. This allows me to create multiple delegates to use. Refer to this Autofac Wiki page if you need a better description. Here's part of…
DavidAndroidDev
  • 2,371
  • 3
  • 25
  • 41
0
votes
3 answers

Unit testing an ASP.NET MVC 3 application

We have an ASP.NET WebForms application that we're going to convert to be ASP.NET MVC application - one of the reasons is so that we may take full advantage of Unit Testing and TDD. Our current WebForms application makes heavy use of HttpModules. …
-1
votes
1 answer

Rhino Mock compatibility with .Net 6

Is any way to make rhino.mocks work in test project with .NET 6 platform? I am always getting Exception, when the code below is called (under .NET 6 project). Exception: Method not found: 'System.Reflection.Emit.AssemblyBuilder…
aBaTaPbl4
  • 1
  • 1
-1
votes
1 answer

What is LastCall for in RhinoMocks?

What is the use of lastcall method in rhino mock? Can you please explain with the help of example?
user132
  • 39
  • 4
-1
votes
1 answer

How to ignore a call of a method inside another method?

I'm using Rhinomock in C#, I would like to ignore a call inside a method. Lets see, Does anybody knows how to ignore (or skip) the method MyMethodToIgnore in following code sample? Is that posible with Rhinomock? public void MyMethod() { string…
-1
votes
1 answer

RhinoMocks Types

Folks How to Exposte RhinoMock Objects as properties I am trying following code snippet internal class Mocks { private MockRepository.GenerateMock formsAuthentication; } but its now working for me anyone…
Snehal
  • 329
  • 3
  • 14
-1
votes
1 answer

GetField value in Rhino Mock tests

I have mock test created like this: IGroup studentGrp = MockRepository.GenerateMock(); stubApplication.Stub(x => x.GetGroup("STUDENT")) .Return(studentGrp); studentGrp.Stub(x => x.EntityCount) …
NoviceMe
  • 3,126
  • 11
  • 57
  • 117
-1
votes
3 answers

Can't figure out why this Rhino Mock is failing? Error: Expected True, But Was: False

Here is the code: public interface IAccessPoint { int BackHaulMaximum { get; set; } bool BackHaulMaximumReached(); void EmailNetworkProvider(); } public class AccessPoint : IAccessPoint { public int BackHaulMaximum { get; set; } …
Xaisoft
  • 45,655
  • 87
  • 279
  • 432
-1
votes
1 answer

ExpectationViolationException from Rhino Mocks for Unit testing in .NET

I have following Unit Test: [Test] public void ReportGeneratorCancelTwiceTest() { var logger = this.mockRepository.StrictMock(); this.manager = new ReportGeneratorManager(logger, new Guid(), 5, null); using…
Osman Esen
  • 1,704
  • 2
  • 21
  • 46
-1
votes
1 answer

How to mock other class object using Rhino Mocks

I am using Visual Studio 2013 and MsTest for unit test and Rhino Mocks for mocking an object. Is there any way, we can mock other class object public class Organization { public DataSet GetUsers() { DataSet ds = new DataSet(); //…
Dream
  • 11
  • 1
  • 1
  • 3
1 2 3
81
82