1
vote
2answers
173 views

Am i fake testing or this is how mocking should be implemented?

I'm new to Rhino mock and i would like to know if the test i did is not fake testing as i red a lot about it. are there any improvements need to be done? [Test] public void ...
4
votes
1answer
146 views

How do I make this code unit-testable?

I have a functionality that imports data into a database, based on an Excel workbook and some meta data (both user-supplied). The functionality implements interface IFunctionality which essentially ...
1
vote
1answer
46 views

unit-testing / mocking a class which contains functionality which depends on itself

Take the below code: public interface ISettingsManager { SettingData GetSettingByIdentifierOrCreateIfDoesNotExist(Enum identifier); T GetSetting<T>(Enum identifier); } [IocComponent] ...
0
votes
3answers
88 views

I need help improving this design for easy unit testing - C#

I am very new to unit testing, I only read a few chapters from 'Art of Unit Testing' and know how to write basic unit tests. I have a deadline for a project so I plan to read 'Professional Test Driven ...
1
vote
1answer
145 views

Verify collection as a method parameter

How can I verify that ohterClassMock.MethodToTest() was called with contracts? That it was called with contract, that have Id = 1 and Param2 = 34 and also with contract2, which has Id = 2 and Param2 ...
3
votes
1answer
130 views

Do these unit tests cover my method under test?

I've written an extension method to truncate strings: /// <summary> /// Returns the string, or a substring of the string with a length of <paramref name="maxLength"/> if the string is ...
4
votes
2answers
149 views

Do I unit test the correct thing

Thats my method to test: public LessonplannerRequest GetWeeklyLessonplanner(int schoolyearId) { Schoolyear schoolyear = ...
2
votes
1answer
62 views

Testing database table creation with NUnit

I'm new to using NUnit and have written a test to check for the existence of a database table. I have the below code that should check whether a new table named NewTable has been created in the ...
5
votes
0answers
157 views

Doubts about the quality of an API designed for use with minimal effort

This is going to be long, and I do hope it is going to make some kind of sense; I apologize if it doesn't. I'll try to provide exactly the amount of context that is necessary to understand the ...
3
votes
3answers
100 views

Test Driving Interface Design

I have been doing TDD since I have started my first job out of university (about 5 months ago), most of which is working with legacy code. I started a personal project today and thought I would TDD ...
8
votes
3answers
792 views

Unit testing legacy code with static classes

I am adding new functionality into a legacy application. For my new classes I have introduced Unit Testing. I still need to work with the existing code. One of the problems I face is that a lot of ...
5
votes
3answers
191 views

Maximum Sub-array Problem

I started taking a look at a programming challenge I had read about earlier today on 8thlight. Unfortunately, it seems to have been taken down and all I could remember about it was the problem posed: ...
4
votes
1answer
101 views

How to make static methods testable?

I am creating an application which will be testable(unit + integration). In this application I have a FileHelper static class, public static class FileHelper { public static void ...
3
votes
1answer
116 views

Test Driven Development, Mocking & Unit-testing

I have the below code which is still under development - but I'm trying to get myself to find the ideal way to move forward. public interface IMemberSubscriptionService { void ...
5
votes
3answers
347 views

String calculator kata

I'm new to C# and just tried the String Calculator Kata for practice. What I like to know is if you (as more experienced C# programmers) have some suggestions for improvement with the end result ...

1 2 3
15 30 50 per page