1,224 questions
0
votes
0
answers
66
views
Unit test for Microsoft.ApplicationBlocks.Data.SqlHelper
Our project is using Microsoft.ApplicationBlocks.Data.SqlHelper to read and write data from a database.
Is it possible to write unit test for the SqlHelper class using mock? If yes, then how?
0
votes
2
answers
1k
views
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....
0
votes
1
answer
52
views
How to use the Stub in Rhino.Mocks to simulate System functions
In unit testing, I often use Stub to mock third-party functions.
But I don't know how to Stub a code like this.
enter image description here
I want to control the return value of registry.
I tried to ...
0
votes
2
answers
4k
views
c# unit test httpclient postasync
I am very new to Testing. I am trying to understand how can I unit test since I do not really need to actually trigger these services but probably mock every step.
How can I unit test the following ...
1
vote
1
answer
134
views
Unit testing DelegateCommand using Rhino Mock
I am trying to unit test a command execution for a command that displays a dialog, however I keep getting NullReferenceException and I do not know why. Any suggestion would be appreciated.
The ...
2
votes
1
answer
206
views
Making RhinoMock Stub Return Value Dependent on a Paramter
Is it possible to set a "default" return value for a RhinoMock stub?
For ex: I have a method that takes in an int from 1-175 and returns a bool:
internal bool myFunction(int number)
I want ...
0
votes
0
answers
871
views
This action is invalid when the mock object is in replay state
I'm converting MSUnit test to XUnit.
public class ClassName
{
protected IDomainQueries MockILogQueries { get; private set; }
protected IQueryContext MockQueryContext { get; private set; }
...
0
votes
0
answers
78
views
C# Stubbing HttpApplicationCompleteRequest() causing NullReferenceException
I have this setup in my unit test
HttpApplication application = MockRepository.GenerateStub<HttpApplication>();
application.Stub(a => a.CompleteRequest());
And when I run the tests it throws ...
6
votes
2
answers
2k
views
can't stub class with NullableContextAttribute
I'm using a third party library which has some classes I'm trying to mock using Rhino Mocks. When I attempt to create a stub for a class, I'm getting the following error. I cna't find a reference to ...
0
votes
2
answers
464
views
Replacement Rhino Mocks GetArgumentsForCallsMadeOn() for Moq Callback() not receiving original arguments
I am trying to replace this Rhino Mocks implementation:
private bool IsHandshakeCalled()
{
var args = httpExecutorBuilderStub.GetArgumentsForCallsMadeOn(st => st.ExecuteHttpWebRequestAndReturn(
...
1
vote
1
answer
513
views
Rhino Mocks exception "Expected #1, Actual #0" in apparently working code
I have a piece of code from an old book on MVVM which works, but a test using Rhino Mocks fails with this message:
Test method TestProject.UnitTest1.UpdateCustomer_Always_CallsUpdateWithCustomer ...
0
votes
0
answers
45
views
Rhino Mocks: Expect a method call after property set
I have a class to test that associates with an interface:
interface IMyFactory
{
int MyProperty {get; set;}
int Create(int x);
}
class ClassToTest
{
public IMyFactory Factory {get; set;}
...
0
votes
1
answer
248
views
Rhino Mocks use input parameters of stubbed function to create return value
I have two interfaces:
interface ITimeframe
{
DateTime beginTime {get;}
DateTime endTime {get;}
}
interface ITimeframeFactory
{
ITimeframe Create(Datetime beginTime, DateTime endTime);
}...
1
vote
1
answer
243
views
How do you stub a method that accepts an IEnumerable in RhinoMocks?
I've got a SqlLayer class I'm trying to Mock that has a GetDataReader method that accepts a string query and an IEnumerable of SqlParameters. I've tried stubbing out the method call like this:
var ...
0
votes
0
answers
191
views
How to handle mocking (Rhino Mock) and unity container in different unit test classes?
I am working on a large desktop application. The application communicates with number of external services and application is using Unity container to resolve the objects. I am facing issue in writing ...