What strategies have Perl people used when mocking Moose objects that they will inject into other Moose objects as type-constrained attributes?
Test::MockObject::Extends doesn't seem to play well with Moose. I need the object to blessed as a specific package though so a vanilla Test::MockObject won't work. I'm sure other folks have had ...
Is there some .Net mocking framework that allows to capture the actual parameter passed to method to examine it latter?
Desired code:
var foo = Mock<Foo>();
var service = Mock<IService>();
service.Expect(s => s.Create(foo));
service.Create(new Foo { Currency = "USD" });
Assert(foo.Object.Currency == "USD");
Or a bit more complex exam...
Is it possible to mock the Assembly class?
If so, using what framework, and how?
If not, how would do go about writing tests for code that uses Assembly?
...
I am just starting to do Test Driven Development, and I am wondering the major differences between RhinoMock, TypeMock, and NUnit's built-in mocking?
Any information would be greatly appreciated!
...
Our product includes some custom hardware, that connects to a PC via USB. We've started looking into automatic testing, but so far I'm unable to find a tool that can record/replay generic USB input.
Does anyone know of such a tool?
(And - it would be best if it's somehow scriptable - testing would have to alternate between GUI interac...
Hi guys
I have been looking at the following and it would appear that there are great benefits to be gained by using compiled queries...
http://blogs.msdn.com/ricom/archive/2008/01/14/performance-quiz-13-linq-to-sql-compiled-query-cost-solution.aspx
My problem is that I want to unit test my queries, but compiled queries need a concre...
Hello,
I have a Unit testing problem where a class has a static variable which wants to load the Spring Application Ctx.
This class DOES NOT come out of the Bean Factory and I cannot change this fact.
static ApplicationContext applicationContext = ...;
This works fine, but is hard to JMock, or atleast I don't know a way and until I...
Its known that DTO doesnt have methods.
Since the controller uses the DTO objects , there is a dependency . should we set expectaions on the properties of DTO(mock DTO properties) while testing the controllers.?
thanks
...
i am required to use mockito to create unit testing framework for existing code. I am unable to find a good place to get started with learning Mockito. Could you please point me to a good learning resource for mockito? (online resource or otherwise)
...
I notice that a lot of people prefer mocha over rspec's built in mocking framework. Can someone explain the advantages of mocha, or any alternative, over rspec's built in mocking framework?
...
I have a web application that I want to run some system tests on, and in order to do that I'm going to need to move the system time around. The application used DateTime all the way through.
Has anyone got any recommendations for how to change the time that DateTime->now reports? The only thing that comes to mind is subclassing DateTi...
During a recent interview I was asked why one would want to create mock objects. My answer went something like, "Take a database--if you're writing test code, you may not want that test hooked up live to the production database where actual operations will be performed."
Judging by response, my answer clearly was not what the interview...
I've never developed using Test Driven Development, and I've never used Mock Objects for unit testing. I've always unit tested simple objects that don't incorporate other aspects of the application, and then moved on to less simple objects that only reference objects that have already been unit tested. This tends to progress until the f...
Consider the following:
new SUT(null, null, new List<IObjectBeingMocked>() { mockObjectOne.Object, mockObjectTwo.Object })
My SUT (System Under Test) needs a list of objects as the third parameter. These need to be mocks as I've set some expectatioins on these.
How would I clear it up so that I can remove the need to call .Object on ...
I am relatively new to unit testing, and completely new to mocking. I have a database class that wraps the DbProvider factory that I would like to create unit tests for without connecting to the database.
How would I mock the DbProvider factory, so I could pass it in to test my class? Would I also need to mock the DbConnection, DbCo...
How can I mock a DataServiceQuery for unit testing purpose?
Long Details follow:
Imagine an ASP.NET MVC application, where the controller talks to an ADO.NET DataService that encapsulates the storage of our models (for example sake we'll be reading a list of Customers). With a reference to the service, we get a generated class inheritin...
I want to simulate MyApp that imports a module (ResourceX) which requires a resource that is not available at the time and will not work.
A solution for this is to make and import a mock module of ResourceX (named ResourceXSimulated) and divert it to MyApp as ResourceX. I want to do this in order to avoid breaking a lot of code and get...
I'm trying to set up and use Mockito into a GWT project, and I'm having trouble using it on the client side (in javascript). I tried to add a module and include Mockito, but it seems not to work (lots of errors). I also tried to do a full checkout from svn and integrate GWT in it that way, the same errors. How should this be done? Thanks...
[TestMethod]
public void Home_Message_Display_Unknown_User_when_coockie_does_not_exist()
{
var context = new Mock<HttpContextBase>();
var request = new Mock<HttpRequestBase>();
context
.Setup(c => c.Request)
.Returns(request.Object);
HomeController controller = new HomeC...
var mockedService = new Mock();
mockedService.Setup(x => x.InterfaceMethod(args)).Returns(value);
_Service = mockedService.Object;
MyController controller =new MyController(_Service);
var result = (ViewResult)controller.Foo();
Now this Foo() Method contains the Following API Call
HttpContext.GetGlobalResourceObject(...,...