Verify a method call using Moq

I am fairly new to unit testing in C# and learning to use Moq. Below is the class that I am trying to test. class MyClass { SomeClass someClass; public MyClass(SomeClass someClass) { this.someClass = someClass; } public void MyMethod(string method) { method = “test” someClass.DoSomething(method); } } class Someclass { public DoSomething(string method) { … Read more

How can I debug my database connection for unit testing?

I’ve set up a wordpress environment on my Mac with MAMP and I’m running 3.5.1 locally (i.e. http://localhost:8888/blog works). I’m trying to run the unit test suit from wordpress.org and having trouble connecting to the database. $svn co https://unit-tests.svn.wordpress.org/trunk wordpress-tests $cd wordpress-tests $cp wp-tests-config-sample.php wp-tests-config.php edit wp-test-config.php for my setup $ cat wp-tests-config.php <?php /* … Read more

How do I simulate a low bandwidth, high latency environment? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I need to simulate a low bandwidth, high latency connection to a server in order … Read more

How can I time a code segment for testing performance with Pythons timeit?

I’ve a python script which works just as it should, but I need to write the execution time. I’ve googled that I should use timeit but I can’t seem to get it to work. My Python script looks like this: import sys import getopt import timeit import random import os import re import ibm_db import … Read more