﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>firefly commented on How many tests?</title><description>Scott got it :)
</description><link>http://ayende.com/3359/how-many-tests#comment18</link><guid>http://ayende.com/3359/how-many-tests#comment18</guid><pubDate>Thu, 12 Jun 2008 03:29:03 GMT</pubDate></item><item><title>Casey commented on How many tests?</title><description>What is the current datetime ... because the "Latest" may well depend on that too....
</description><link>http://ayende.com/3359/how-many-tests#comment17</link><guid>http://ayende.com/3359/how-many-tests#comment17</guid><pubDate>Wed, 11 Jun 2008 07:13:32 GMT</pubDate></item><item><title>Peter Ritchie commented on How many tests?</title><description>Another vote for more information:
  
Does it throw exceptions?  If so, what ones, and why?
  
Does it GetLatest() modify the state of the instance of the type it's contained in.  If so, under what conditions?
  
Is a null a valid return value.  If so, under what conditions will this occur?
  
  
...plus the other questions about more information.
</description><link>http://ayende.com/3359/how-many-tests#comment16</link><guid>http://ayende.com/3359/how-many-tests#comment16</guid><pubDate>Wed, 11 Jun 2008 01:17:16 GMT</pubDate></item><item><title>James Hicks commented on How many tests?</title><description>More information is needed.  What are the rules surrounding the publishing of web casts?  Can more than one webcast be published on the same date?  If so, do you rank them by their Id?  How is a null PublishDate handled - is it in the future or in the past?
  
</description><link>http://ayende.com/3359/how-many-tests#comment15</link><guid>http://ayende.com/3359/how-many-tests#comment15</guid><pubDate>Tue, 10 Jun 2008 21:34:52 GMT</pubDate></item><item><title>Thomas Eyde commented on How many tests?</title><description>1, if you accept whitebox tests.
  
  
</description><link>http://ayende.com/3359/how-many-tests#comment14</link><guid>http://ayende.com/3359/how-many-tests#comment14</guid><pubDate>Tue, 10 Jun 2008 19:22:53 GMT</pubDate></item><item><title>Ayende Rahien commented on How many tests?</title><description>Alex,
  
Because you may want to have a webcast that is not published.
  
  
Scott, 
  
LOL
</description><link>http://ayende.com/3359/how-many-tests#comment13</link><guid>http://ayende.com/3359/how-many-tests#comment13</guid><pubDate>Tue, 10 Jun 2008 18:59:08 GMT</pubDate></item><item><title>Andyk commented on How many tests?</title><description>I agree David, always 42!! ;)
</description><link>http://ayende.com/3359/how-many-tests#comment12</link><guid>http://ayende.com/3359/how-many-tests#comment12</guid><pubDate>Tue, 10 Jun 2008 18:51:55 GMT</pubDate></item><item><title>Scott Bellware commented on How many tests?</title><description>Any attempts to answer this question that aren't phrased along the lines of "can you tell me more about the acceptance criteria" will be addressed by our human resources staff during your exit interview.
</description><link>http://ayende.com/3359/how-many-tests#comment11</link><guid>http://ayende.com/3359/how-many-tests#comment11</guid><pubDate>Tue, 10 Jun 2008 18:45:48 GMT</pubDate></item><item><title>Alex Simkin commented on How many tests?</title><description>Why PublishDate is nullable?
</description><link>http://ayende.com/3359/how-many-tests#comment10</link><guid>http://ayende.com/3359/how-many-tests#comment10</guid><pubDate>Tue, 10 Jun 2008 18:40:06 GMT</pubDate></item><item><title>Richard Lennox commented on How many tests?</title><description>You must not forget the case where there are 0 webcasts or where the colection is null.
</description><link>http://ayende.com/3359/how-many-tests#comment9</link><guid>http://ayende.com/3359/how-many-tests#comment9</guid><pubDate>Tue, 10 Jun 2008 18:19:28 GMT</pubDate></item><item><title>James Curran commented on How many tests?</title><description>It depends on the purpose of the class this method comes from.  Is it the ultimate source for information on Webcasts, or is it just your local access point for it.
  
  
In other word, does this class hold a handle to a database connection or a RSS feed; or *is* it the database?
  
  
If it is the ultimate source, then there are probably a lot that should be done, but say which would require more intimate details of the class.
  
  
If it's local the local access point, then you are pretty much limited to range/reasonableness checks on the properties of the returned object.  Anything beyond that, you aren't testing the method, your're testing the mocks.
  
</description><link>http://ayende.com/3359/how-many-tests#comment8</link><guid>http://ayende.com/3359/how-many-tests#comment8</guid><pubDate>Tue, 10 Jun 2008 17:29:16 GMT</pubDate></item><item><title>David Alpert commented on How many tests?</title><description>42; always 42.
</description><link>http://ayende.com/3359/how-many-tests#comment7</link><guid>http://ayende.com/3359/how-many-tests#comment7</guid><pubDate>Tue, 10 Jun 2008 16:54:55 GMT</pubDate></item><item><title>Vijay Santhanam commented on How many tests?</title><description>7!
</description><link>http://ayende.com/3359/how-many-tests#comment6</link><guid>http://ayende.com/3359/how-many-tests#comment6</guid><pubDate>Tue, 10 Jun 2008 16:51:50 GMT</pubDate></item><item><title>Zack Owens commented on How many tests?</title><description>It depends on what the GetLatest() method's dependencies are. You probably don't have to test the Webcast class unless there is actually code that you have written.. if it's just a bunch of properties, there is no need to test whether the .NET framework does its job.
</description><link>http://ayende.com/3359/how-many-tests#comment5</link><guid>http://ayende.com/3359/how-many-tests#comment5</guid><pubDate>Tue, 10 Jun 2008 16:29:53 GMT</pubDate></item><item><title>Cory Foy commented on How many tests?</title><description>It's a trick question. It takes as many tests as is necessary to drive out the design. 
  
  
I'd probably start with something like:
  
  
public void GetLatestWebcastCallsGetLatestOfDAO();
  
  
since we'll have some sort of data access. I'd also likely have tests in place for equality and hashCode of the Webcast object itself (though it could be 
[abstracted away](http://www.cornetdesign.com/2008/05/unit-testing-equals-and-hashcode-of.html)). 
  
  
Then, for the DAO, I'd likely have tests in place to make sure that we were calling the data layer correctly, probably by using an in-memory DB. Then we'd need integration tests to make sure everything was working correctly.
  
  
The whole nullable DateTime seems interesting - but it also seems like it would be abstracted by the data access layer. If we store the webcasts in a file system, then we have at least the create or last modified date. If they are in the database, then we could use the max primary key, or filter out those records which don't have a publish date.
  
  
So, filtering out the test cases for Webcast itself, and the data access layer, then we'd need one - an interaction-based tests which verifies that GetLatestWebcast calls the appropriate DAL method.
</description><link>http://ayende.com/3359/how-many-tests#comment4</link><guid>http://ayende.com/3359/how-many-tests#comment4</guid><pubDate>Tue, 10 Jun 2008 16:28:43 GMT</pubDate></item><item><title>Chris commented on How many tests?</title><description>@JacobM - Yet another case is what should GetLatest() do if (!PublishDate.HasValue)?
</description><link>http://ayende.com/3359/how-many-tests#comment3</link><guid>http://ayende.com/3359/how-many-tests#comment3</guid><pubDate>Tue, 10 Jun 2008 16:20:09 GMT</pubDate></item><item><title>JacobM commented on How many tests?</title><description>Enough to ensure that you are correctly getting the Webcast that has the most recent PublishDate, not simply the one that happens to have been most recently added to wherever the Webcasts are stored.  Maybe make sure it works when there are no Webcasts stored, when there is one Webcast, and when there are multiple Webcasts.
  
  
 Here's a question -- what if the PublishDate is in the future?  Should it be returned?  If not, that's another test.
  
  
What happens if two Webcasts have the same PublishDate?  Which one is "the latest"?  Whatever the answer, there's a scenario for another test.
  
  
</description><link>http://ayende.com/3359/how-many-tests#comment2</link><guid>http://ayende.com/3359/how-many-tests#comment2</guid><pubDate>Tue, 10 Jun 2008 15:49:43 GMT</pubDate></item><item><title>Charles commented on How many tests?</title><description>None, good programmers write perfect code first time.
</description><link>http://ayende.com/3359/how-many-tests#comment1</link><guid>http://ayende.com/3359/how-many-tests#comment1</guid><pubDate>Tue, 10 Jun 2008 15:38:15 GMT</pubDate></item></channel></rss>