tdd

TDD - How to write test case for a method that as Assembly.LoadFrom(...)

I have got method which is using Assembly.LoadFrom(...) statement and returns the supported cultures from that satellite assembly, so how could I write unit tests for that type of methods. What I did was, wrapped that static method/logic to return cultures in anther class and used it's instance method. Is this the right approach? ...

should the DTO objetcs be mocked while testing controllers ?

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 ...

RhinoMocks exceptions when stubbing out Equals method

Hi! I've a problem setting up a test for an Equals method on an object. The object in question is defined by this interface: public interface IHours { ITimeOfDay OpenAt { get; set; } ITimeOfDay CloseAt { get; set; } DateTime ValidFrom { get; set; } DateTime ValidTo { get; set; } bool isCovered(DateTime time); } a...

How does Test Driven Design help a one man software project?

I've spent a lot of time building out tests for my latest project, and I'm really not sure what the ROI was on the time spent. I'm a one man operation, and I'm building web applications. I don't necessarily have to "prove" that my software works to anyone (except my users), and I'm worried that I spent a good deal of time needlessly ...

Unit test proper data structure creation

How would one test whether data structure built properly? I'm implementing kind of modified radix tree, and been wondering how do you check if your data structure builds up correctly. Consider a tree of TreeNode {String, Int} nodes. You always want to append new child to deepest node of value equal to 0, as in following example: Root,...

How to practice TDD on a web app?

I am a newcomer to TDD. What are some of the techniques you guys use on applying TDD to the development of a webapp? I am looking for advice for a newcomer. Practical examples or "war stories" would be appreciated. :) Bonus: What is some of the software you use for TDD (ideally for a LAMP stack). ...

Mocking vs. faking, when to use what?

Can anyone come up with a guidelines kind of stuff, suggesting the ideal scenarios when to go for mocking or faking (setting up the essentials manually). Bit confused with the approach? ...

TDD with DataGridView

I'm relatively new to TDD, and still trying to learn to apply some of the concepts. Here's my situation. I've got a WinForm with a DataGridView. I'm trying to write a test for the routine to be called by a button click that will perform some operations on the selected rows of the grid. So I will be passing in the DataGridViewSelectedRo...

Testing for required behaviour vs. TDD

In the article Test for Required Behavior, not Incidental Behavior, Kevlin Henney advises us that: "[...] a common pitfall in testing is to hardwire tests to the specifics of an implementation, where those specifics are incidental and have no bearing on the desired functionality." However, when using TDD, I often end up writing tes...

Which of these tools/technologies should I start learning first?

I'm gearing up to jump ship at my current company in (hopefully) 9 months or so. I'm a c# developer but don't have experience past the 2.0 framework and VS2005 due to the OS limitations of our target environment. Last year we had a consultant come in for about 9 months or so and he opened my eyes to new technologies, etc.. I still kee...

Test Driven Development presentation

I need a short presentation on TDD to show at a company meeting. It need to be a on-line talk and not longer than 35 minutes. Do you have any recommendations? ...

TDD with diagrams

I have an app which draws a diagram. The diagram follows a certain schema, for e.g shape X goes within shape Y, shapes {X, Y} belong to a group P ... The diagram can get large and complicated (think of a circuit diagram). What is a good approach for writing unit tests for this app? ...

Philisophical Questions about Test-Driven Development

I have been perpetually intrigued by test-driven development, but I can never follow through with it when I try it on real projects. I have a couple of philosophical questions that continually arise when I try it: How do you handle large changes? When it comes to testing single functions (some parameters, a result value, few side eff...

TDD in a text file import project

I'm just starting, and yes, i haven't written any tests yet (I'm not a fundamentalist, I don't like compile errors just because there is no test), but I'm wondering where to get started on doing a project that parses fixed length flat file records according to an XML mapping, into a class that represents the superset of all file layouts,...

How to Bypass HTTPContext Usage .?

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(...,...

Mocking virtual readonly properties with moq.

I couldn't find a way to do this, though this can be done by hand so why not with moq? ...

How to use TDD correctly to implement a numerical method?

I am trying to use Test Driven Development to implement my signal processing library. But I have a little doubt: Assume I am trying to implement a sine method (I'm not): Write the test (pseudo-code) assertEqual(0, sine(0)) Write the first implementation function sine(radians) return 0 Second test assertEqual(1, sine(pi)) At...

TDD framework for C

I am a ruby programmer and I really like to do TDD. Right now, I am programming a little bit in C, but I like my tools and the way I program with ruby. So, I am searching for a framework to do unit tests in C. What do you can tell me about it? I already found some options, like: cunit, cmockery, CuTest and others. The problem is, I don'...

Unit Testing with fakes or mocks?

I'm trying to follow good practices when writing my testing suites. Halfway through i realised that iam spending alot (Most) of my time on the Fake Objects...Most of my tests does something like this public interface ITemplateRepository { string get GetGenericTemplate {get;} } public FakeTemplateRepository : ITemplateRepository ...

Getting started with TDD and DDD

I've just finished reading "Domain-driven design: tackling complexity in the heart of software" by Eric Evans and I'm attempting to write my first domain-centric application (in C#). The application will be used by our helpdesk to track the allocation of computers to users. I've sketched a simple class diagram to reflect part of the do...