2008-02-07から1日間の記事一覧

C#、言語内DSLでHTML構築、の試案

C#

生成ターゲット: <html> <head><title>hoge</title></head> <body> <h1>hoge</h1> <p><strong>hoge</strong></p> <p class="hoge" id="the_text">this is the text</p> <ul> <li>item1</li> <li>item2</li> <li>item3</li> </ul> </body> </html> var list=new[]{"item1","item2","item3"}; //plan a HtmlBuilder.Begin(s=>{ s.htm…

拡張メソッドでNUnitを快適にする

C#

public static class Extention { public static void should_be<T>(this T th,T expected) {Assert.AreEqual(th,expected);} } で、 //before Assert.AreEqual(obj.DoSomething(),"result"); Assert.That(obj.DoSomething(),Is.EqualTo("result")); //2.4の新</t>…

アスペクトほしいよー、とかなんとか。

C#

ことの発端。 TextWriter writer=new SomeTextWriter("hogehoge"); tw.Write( Something() ); tw.Write( AnotherSomething() ); なんてコードがあって。 デバッグのために、Writeされた内容を表示したくなったとしよう(というか、したんですよ)。 string con…