<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Directed Graph</title>
	<atom:link href="http://tgmayfield.com/notes/feed" rel="self" type="application/rss+xml" />
	<link>http://tgmayfield.com/notes</link>
	<description>by Thomas G. Mayfield</description>
	<pubDate>Fri, 18 Jul 2008 19:08:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Comforting Quirks</title>
		<link>http://tgmayfield.com/notes/archives/uncategorized/comforting-quirks</link>
		<comments>http://tgmayfield.com/notes/archives/uncategorized/comforting-quirks#comments</comments>
		<pubDate>Fri, 18 Jul 2008 19:08:18 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tgmayfield.com/notes/?p=8</guid>
		<description><![CDATA[For those that don&#8217;t know me so well, I need you to read a post entitled The Quirkbook on Rands in Repose.
Truth be told, at least 4 out of 5 of those listed and the comments following (or ones very like them) are quirks I grew up with.  I&#8217;ve worked and worked to get [...]]]></description>
			<content:encoded><![CDATA[<p>For those that don&#8217;t know me so well, I need you to read a post entitled <a href="http://www.randsinrepose.com/archives/2008/07/18/the_quirkbook.html">The Quirkbook</a> on Rands in Repose.</p>
<p>Truth be told, at least 4 out of 5 of those listed and the comments following (or ones very like them) are quirks I grew up with.  I&#8217;ve worked and worked to get rid of most of them, but more come to fill their space, or they just morph into something less obvious to an observer.</p>
<p>Up until reading that, the only people I&#8217;ve encountered with similar issues were actors, portraying crazy people.</p>
]]></content:encoded>
			<wfw:commentRss>http://tgmayfield.com/notes/archives/uncategorized/comforting-quirks/feed</wfw:commentRss>
		</item>
		<item>
		<title>Failing unit test for NHibernate configuration warnings/errors</title>
		<link>http://tgmayfield.com/notes/archives/nhibernate/failing-unit-test-for-nhibernate-configuration-warningserrors</link>
		<comments>http://tgmayfield.com/notes/archives/nhibernate/failing-unit-test-for-nhibernate-configuration-warningserrors#comments</comments>
		<pubDate>Fri, 11 Jul 2008 17:34:59 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
		
		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://tgmayfield.com/notes/?p=7</guid>
		<description><![CDATA[I&#8217;d mentioned on Dave Laribee&#8217;s Test Your NHibernate Mappings! post that you can use a custom log4net appender to catch the messages NHibernate outputs on initialization. Here&#8217;s a bit more detail.
First, the custom ListAppender class:
class ListAppender
    : log4net.Appender.AppenderSkeleton
{
    private List&#60;LoggingEvent&#62; _events = new List&#60;LoggingEvent&#62;();
    public List&#60;LoggingEvent&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d mentioned on Dave Laribee&#8217;s <a href="http://codebetter.com/blogs/david_laribee/archive/2008/06/17/test-your-nhibernate-mappings.aspx">Test Your NHibernate Mappings!</a> post that you can use a custom log4net appender to catch the messages NHibernate outputs on initialization. Here&#8217;s a bit more detail.</p>
<p>First, the custom ListAppender class:</p>
<pre><code>class ListAppender
    : log4net.Appender.AppenderSkeleton
{
    private List&lt;LoggingEvent&gt; _events = new List&lt;LoggingEvent&gt;();
    public List&lt;LoggingEvent&gt; Events
    {
        get { return _events; }
    }

    protected override void Append(log4net.Core.LoggingEvent loggingEvent)
    {
        _events.Add(loggingEvent);
    }
}</code></pre>
<p>And a sample unit test:</p>
<pre><code>[Test]
public void TreatNHibernateWarningsAsFailures()
{
    ListAppender appender = new ListAppender()
    {
        Threshold = log4net.Core.Level.Warn,
    };
    log4net.Config.BasicConfigurator.Configure(appender);

    string myConfigPath = @"wherever\you\put\your\NHibernate\config.xml";
    Configuration config = new Configuration().Configure(myConfigPath);

    using (ISessionFactory factory = config.BuildSessionFactory())
    {
        // Spin up the factory and then throw it away. We just want to guarantee that initialization has occurred.
    }

    if (appender.Events.Count == 0)
    {
        return;
    }

    StringBuilder errors = new StringBuilder();
    errors.Append("Warnings/errors issued when starting up NHibernate:");

    foreach (log4net.Core.LoggingEvent ev in appender.Events)
    {
        errors
            .AppendLine()
            .AppendFormat("\t{0}: {1} - {2}", ev.Level, ev.LoggerName, ev.RenderedMessage);
    }

    Assert.Fail(errors.ToString());
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://tgmayfield.com/notes/archives/nhibernate/failing-unit-test-for-nhibernate-configuration-warningserrors/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
