can someone suggest the ideal Unit test cases that may fit in across each of the layers .
(which otherwise can be called as a standard).
for instance, in an ASP.NET MVC applictaion using a Repository pattern -
Controller - can assert for View names and format of the data returned to the views , from the controller action methods( i ...
Hi.
In my code, I am occasionally passed various byte arrays and such. Also, they may be managed objects. I would like to preserve those memory structures so that I can write test cases against the concrete examples.
My standard approach is to hit the breakpoint, use the debugger to find the various values and then either new them up o...
I'm looking for a way to apply TDD to Session Beans.
can anyone provide advices and links on how to unit test them ?
how to use JUnit to do so ?
P.S : I'm new to Test Driven Development and Session Beans.
I'm using EJB v2.
...
This is a test suite that is green using Rhino Mocks.
[SetUp]
public void BeforeEachTest()
{
_mocksRepo = new MockRepository();
_mockBank = _mocksRepo.StrictMock<IBank>();
//_mockPrinter = _mocksRepo.StrictMock<IPrinter>();
_mockPrinter = _mocksRepo.DynamicMock<IPrinter>();
_mockLogger = _mocksRepo.Str...
I am working on an asp.net mvc application and writing my unit tests BDD style.
Eg.
GetResource_WhenResourceFileExists_ShouldReturnResources()
But when I am writing tests for my controllers, I usually have two Methods with the same name. One without parameters for get requests and one with for posts. Does anybody have a good naming...
While using Repository pattern I find it difficult to understand the reason of designing the software with TDD technique while in reality you will have to implement the Interface for your repository in your persistence dataset.
To make my point clear I will submit an example:
I have the following Interface on my domain model:
public i...
I am learning about unit-testing best-pratices (especially thanks to this post : What makes good unit-test?), because during my project we started to make unit-tests in a bit anarchic way. So now I have to get almost everything from the start to apply strong testing method.
One question the quoted post did not answered was do I have to ...
Hello all
I am currently involved in developing with C# - Here is some background:
We implement MVP with our client application and we have a cyclomatic rule which states that no method should have a cyclomatic complexity greater than 5.
This leads to a lot of small private methods which are generally responsible for one thing.
My ques...
Am writing unit tests for an app that has matured a lot with time..We are using NDBUnit as the test cases become independent of each other..while we started the development of this app the DB schema was pretty manageable and hence dragging and dropping the tables on VS designer to create an XSD was never an issue. Well, with my current D...
I have difficulty in many situations to come up with a good unit test names for classes and methods. Typically, I try to follow the form:
public class TestContext
{
[Fact]
public void WhenThis_DoThat()
{
}
}
Some put words Given, When, and Then on the parts to be explicit. I like it because it seems to make the unit ...
BBD is referenced in this thread (Karl Seguin's answer). What is BDD?
...
How do I test the scope of a registered type with structureMap?
For instance I have a registry:
public class DataRegistry : Registry
{
public DataRegistry()
{
ForRequestedType<ISessionManager>().TheDefaultIsConcreteType<SessionManager>().CacheBy(StructureMap.Attributes.InstanceScope.Singleton);
ForRequestedTyp...
For my project I am using the integrated Visual Studio unit-testing framework but I am having some issues that I never saw before.
One of my classes is causing VSTestHost to crash. So first I though it was because there was a bunch of code causing a stack overflow. What is really strange is that now, even if I create a new project or us...
TypeMock is too expensive for a hobbist like me :)
Moq or the next version of RhinoMocks have no plans on listening to the profiling API, why is that?
EDIT: This enables features such as:
Mocking non-virtual methods and
properties (!).
Mocking browser
environments.
simpler syntax which
is less fragile (and not having to go
trough...
I have an IEntity interface that implements an interface, IValidatable
public interface IValidatable {
bool IsValid { get; }
bool IsValidForPersistence { get; }
// Rules applied at UI time (please enter your name, etc)
IEnumerable<RuleViolation> GetRuleViolations();
// Rules to be applied only at persistence time
...
I'm writing a small program in Ruby to parse a hand history log from a poker site.
The log is split over several lines and looks a bit like this:
Table 123456 NL Hold'em $1/$2
5 Players
Seat 3 is the button
Seat 1: randomGuy112 $152.56
Seat 2: randomGirl99 $200
Seat 3: PokerPro $357.12
Seat 4: FishCake556 $57.19
Seat 6: MooMoo $188.98
D...
I am trying to test that the business rule of not allowing to share the same space with a user twice. Below is the method being tested. The line having the issue is marked below.
public void ShareSpace(string spaceToShare,string emailToShareIt)
{
SharedSpace shareSpace = new SharedSpace();
shareSpace.InvitationCode = Guid.NewGuid()...
Hi there,
can anyone help?
I have created a WCF library (not application) and i will be hosting this in a SVC IIS page..
But i was wanting to load the unity stuff in generic place... I could load it in the global.asax but then its tied to the IIS Asp.net container and when doing TDD this part wouldn't execute so not of my resolves wou...
Can anyone suggest books or material Unit Tests? Some people consider codes without unit tests as legacy codes. Nowadays, Test Driven Development is the approach for managing big software projects with ease. I like C++ a lot, I learnt it on my own without any formal education. I never looked into Unit Test before, so feel left out. I thi...
I am using rspec for my test in a ruby project, and I want to spec that my program should not output anything when the -q option is used. I tried:
Kernel.should_not_receive :puts
That did not result in a failed test when there was output to the console.
How do I verify the absents of text output?
...