﻿<?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>Denis commented on Answer: How many tests?</title><description>It seems that the size of the test class compared to the size of the implementation class is going to frighten people. See http://www.dotnetguru.org/modules.php?op=modload&amp;name=News&amp;file=article&amp;sid=1090 (in french).
  
  
I think you could underline that some of the code in the test class is not related to unitary testing GetLatest(). Many lines setup and test the persistance layer (can_save, can_load). Shouldn't we assume that the persistance layer (the Inner property)  is tested elsewhere by another set of unit tests ?
  
</description><link>http://ayende.com/3361/answer-how-many-tests#comment16</link><guid>http://ayende.com/3361/answer-how-many-tests#comment16</guid><pubDate>Thu, 19 Jun 2008 21:46:41 GMT</pubDate></item><item><title>Alexander Gro&amp;#195;Ÿ commented on Answer: How many tests?</title><description>Sounds reasonable. That's also what I did, although it makes the registration a bit more complicated.
</description><link>http://ayende.com/3361/answer-how-many-tests#comment15</link><guid>http://ayende.com/3361/answer-how-many-tests#comment15</guid><pubDate>Mon, 16 Jun 2008 16:32:51 GMT</pubDate></item><item><title>Ayende Rahien commented on Answer: How many tests?</title><description>In this case, I don't have different impl, so I don't care.
  
If I would, I would register WebcastRepository twice, once for IWebcastRepository and the second for IRepository&lt;Webcast&gt;
</description><link>http://ayende.com/3361/answer-how-many-tests#comment14</link><guid>http://ayende.com/3361/answer-how-many-tests#comment14</guid><pubDate>Mon, 16 Jun 2008 16:18:51 GMT</pubDate></item><item><title>Alexander Gro&amp;#223; commented on Answer: How many tests?</title><description>My question stems from the following use case: Say you're overriding methods of RepositoryDecorator&lt;T&gt; in a derived class to have further validation happening before a save/insert takes place.
  
  
I would want users of the repository make "fall into the pit of success" (via Scott Hanselman) such that calls to Repository&lt;T&gt;.Save are forced through the custom repo. The problem I see is that you now have
  
a) a custom repo that should be invoked when Repository&lt;T&gt; is used
  
b) an extended repo with methods like GetLatest()
  
both implemented by one class, but accessible through two Windsor service interfaces.
  
  
From an application point of view you could now use one of the three APIs above (a, b, c). Which one do you prefer?
  
  
Alex
</description><link>http://ayende.com/3361/answer-how-many-tests#comment13</link><guid>http://ayende.com/3361/answer-how-many-tests#comment13</guid><pubDate>Mon, 16 Jun 2008 15:25:58 GMT</pubDate></item><item><title>Ayende Rahien commented on Answer: How many tests?</title><description>Here is my full configuration file:
  
  
import Castle.MonoRail.Framework
  
import Castle.MonoRail.WindsorExtension
  
import Rhino.Commons.Facilities from Rhino.Commons.ActiveRecord
  
import file from Configuration.boo
  
  
facility MonoRailFacility
  
facility RhinoTransactionFacility
  
facility ActiveRecordUnitOfWorkFacility:
  
    assembly = "HibernatingRhinos"
  
  
for type in AllTypesBased of IController("HibernatingRhinos"):
  
    component type.Name, type
  
  
for type in AllTypesBased of ViewComponent("HibernatingRhinos"):
  
    component type.Name, type
  
  
fromHibernatingRhinosServices = {t as System.Type | t.Namespace == "HibernatingRhinos.Services"}   
  
for type in AllTypes("HibernatingRhinos") \
  
    .Where(fromHibernatingRhinosServices):
  
    component type.GetFirstInterface(fromHibernatingRhinosServices), type
  
  
SetupConfigurationProperties()
</description><link>http://ayende.com/3361/answer-how-many-tests#comment12</link><guid>http://ayende.com/3361/answer-how-many-tests#comment12</guid><pubDate>Mon, 16 Jun 2008 14:05:00 GMT</pubDate></item><item><title>Alexander Gro&amp;#223; commented on Answer: How many tests?</title><description>How do you register WebcastRepository in your Windsor config?
  
  
Because the class implements two interfaces (IRepository&lt;Webcast&gt; and IWebcastRepository for the "special" methods) it actually implements two services.
  
  
Do you register two services for the class? (Not sure if this is possible, though.)
  
  
From the application/controller point of view, when do you use
  
a) Repository&lt;Webcast&gt;.SomeMethod()
  
b) IoC.Resolve(IWebcastRepository).SomeMethod()
  
c) IoC.Resolve(WebcastRepository).SomeMethod()
  
?
  
  
Thanks,
  
  
Alex
</description><link>http://ayende.com/3361/answer-how-many-tests#comment11</link><guid>http://ayende.com/3361/answer-how-many-tests#comment11</guid><pubDate>Mon, 16 Jun 2008 14:01:18 GMT</pubDate></item><item><title>Ayende Rahien commented on Answer: How many tests?</title><description>I am using it, it is working well enough for most common scenarios.
  
We are still missing some parts in the more complex queries, but we are working on that.
  
</description><link>http://ayende.com/3361/answer-how-many-tests#comment10</link><guid>http://ayende.com/3361/answer-how-many-tests#comment10</guid><pubDate>Sun, 15 Jun 2008 11:29:22 GMT</pubDate></item><item><title>andy commented on Answer: How many tests?</title><description>looks like you're using NHibernate.Linq. what is the state of the project and would you also use it by now in a real project? When there will be the first release?
</description><link>http://ayende.com/3361/answer-how-many-tests#comment9</link><guid>http://ayende.com/3361/answer-how-many-tests#comment9</guid><pubDate>Sun, 15 Jun 2008 09:02:33 GMT</pubDate></item><item><title>Ayende Rahien commented on Answer: How many tests?</title><description>This is part of Rhino Commons, it is a way to run under a transaction.
  
the ()=&gt; is a labmda, a C# 3.0 concept
</description><link>http://ayende.com/3361/answer-how-many-tests#comment8</link><guid>http://ayende.com/3361/answer-how-many-tests#comment8</guid><pubDate>Fri, 13 Jun 2008 15:27:32 GMT</pubDate></item><item><title>Yeroc commented on Answer: How many tests?</title><description>Forgive my ignorance.  I"ve following your blog after learning how nice Rhino Mocks was.  Could explain this line of code?  I'm unfamiliar with much of what's going on here?
  
  
With.Transaction(() =&gt; webcastRepository.Save(webcast));
  
  
  
I assume With is one of the Rhino.Common classes?  What is "() =&gt; " doing?  I've never seen that syntax in C#.
  
  
Thanks
</description><link>http://ayende.com/3361/answer-how-many-tests#comment7</link><guid>http://ayende.com/3361/answer-how-many-tests#comment7</guid><pubDate>Fri, 13 Jun 2008 14:04:49 GMT</pubDate></item><item><title>Ayende Rahien commented on Answer: How many tests?</title><description>That is why I have SystemTime.Now()
</description><link>http://ayende.com/3361/answer-how-many-tests#comment6</link><guid>http://ayende.com/3361/answer-how-many-tests#comment6</guid><pubDate>Thu, 12 Jun 2008 15:04:01 GMT</pubDate></item><item><title>Bill Pierce commented on Answer: How many tests?</title><description>Don't know that it should appear in your tests but the only other concern would be issues related to not using UTC dates when working with 'Latest' data.
</description><link>http://ayende.com/3361/answer-how-many-tests#comment5</link><guid>http://ayende.com/3361/answer-how-many-tests#comment5</guid><pubDate>Thu, 12 Jun 2008 14:57:03 GMT</pubDate></item><item><title>Ayende Rahien commented on Answer: How many tests?</title><description>Hm, thinking about it, the test that test for no published results is the same, the code doesn't know if there are unpublished webcasts, after all
</description><link>http://ayende.com/3361/answer-how-many-tests#comment4</link><guid>http://ayende.com/3361/answer-how-many-tests#comment4</guid><pubDate>Thu, 12 Jun 2008 13:31:44 GMT</pubDate></item><item><title>Ayende Rahien commented on Answer: How many tests?</title><description>First or default would return null, yes.
  
I actually forgot about this
</description><link>http://ayende.com/3361/answer-how-many-tests#comment3</link><guid>http://ayende.com/3361/answer-how-many-tests#comment3</guid><pubDate>Thu, 12 Jun 2008 13:09:15 GMT</pubDate></item><item><title>Richard Lennox commented on Answer: How many tests?</title><description>I am interested in why you haven't tested the default when there are no Webcasts in the repository? I can see that your GetLatesMethod has a FirstOrDefault() does the method for this test cover this scenario?
</description><link>http://ayende.com/3361/answer-how-many-tests#comment2</link><guid>http://ayende.com/3361/answer-how-many-tests#comment2</guid><pubDate>Thu, 12 Jun 2008 12:26:42 GMT</pubDate></item><item><title>Vijay Santhanam commented on Answer: How many tests?</title><description>I said 7, I was the closest I think.
</description><link>http://ayende.com/3361/answer-how-many-tests#comment1</link><guid>http://ayende.com/3361/answer-how-many-tests#comment1</guid><pubDate>Thu, 12 Jun 2008 10:46:40 GMT</pubDate></item></channel></rss>