2
votes
1answer
110 views

Is a unit test which uses LINQ to check multiple values acceptable?

I'm writing unit tests for a library which parses colors from user input (example: the user input “#f00” gives a red color; the user input “60,100%,100%” gives a yellow color, etc.) One of the ...
2
votes
1answer
60 views

Unit test provider roles

I am unit testing this role provider. I have a few asserts in the code for my test. I am sure there are more test I could preform. Does anyone have any suggestions for more test for this role of the ...
1
vote
2answers
179 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 ...
1
vote
1answer
52 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] ...
4
votes
1answer
160 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 ...
0
votes
3answers
114 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
148 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 ...
4
votes
2answers
156 views

Do I unit test the correct thing

Thats my method to test: public LessonplannerRequest GetWeeklyLessonplanner(int schoolyearId) { Schoolyear schoolyear = ...
2
votes
1answer
95 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
174 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 ...
4
votes
1answer
126 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 ...
5
votes
3answers
222 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: ...
3
votes
3answers
102 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 ...
3
votes
1answer
147 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 ...
3
votes
1answer
122 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 ...

1 2 3
15 30 50 per page