<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>FsTest Forum Rss Feed</title><link>http://www.codeplex.com/FsTest/Thread/List.aspx</link><description>FsTest Forum Rss Description</description><item><title>New Post: Additional Test methods</title><link>http://fstest.codeplex.com/Thread/View.aspx?ThreadId=80504</link><description>&lt;div style="line-height: normal;"&gt;&lt;div&gt;
&lt;p&gt;I'd like to suggest adding a couple of methods:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
let fail_with (msg:string) (error:Lazy&amp;lt;_&amp;gt;) =
    let mutable threw = false
    try
        try 
            error.Force() |&amp;gt; ignore
        with
        | Failure message -&amp;gt; 
            threw &amp;lt;- true
    //            Assert.Contains(msg,message)
            if not &amp;lt;| message.Contains(msg) then
                raise &amp;lt;| Xunit.Sdk.AssertActualExpectedException(msg,message,&amp;quot;Failure should contain:&amp;quot;)
        | e -&amp;gt; 
            threw &amp;lt;- true
            raise &amp;lt;| Xunit.Sdk.ThrowsException(typeof&amp;lt;System.Exception&amp;gt;,e)
    finally 
        if not threw then
            raise &amp;lt;| Xunit.Sdk.ThrowsException(typeof&amp;lt;System.Exception&amp;gt;)
        
let fail_withi (msg:string) (error:Lazy&amp;lt;_&amp;gt;) =
    let mutable threw = false
    try
        try 
            error.Force() |&amp;gt; ignore
        with
        | Failure message -&amp;gt; 
            threw &amp;lt;- true
//            Assert.Contains(msg,message)
            if message.IndexOf(msg,System.StringComparison.OrdinalIgnoreCase) &amp;gt;= 0 then
                raise &amp;lt;| Xunit.Sdk.AssertActualExpectedException(msg,message,&amp;quot;Failure should contain:&amp;quot;)
        | e -&amp;gt; 
            threw &amp;lt;- true
            raise &amp;lt;| Xunit.Sdk.ThrowsException(typeof&amp;lt;System.Exception&amp;gt;,e)
    finally 
        if not threw then
            raise &amp;lt;| Xunit.Sdk.ThrowsException(typeof&amp;lt;System.Exception&amp;gt;)

let match' regexp result =
    Assert.True(System.Text.RegularExpressions.Regex.IsMatch(result,regexp),sprintf &amp;quot;Result: %s should match %s&amp;quot; result regexp)

let not_match regexp result = 
    Assert.False(System.Text.RegularExpressions.Regex.IsMatch(result,regexp),sprintf &amp;quot;Result: %s should not match %s&amp;quot; result regexp)

&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description><author>cipher</author><pubDate>Tue, 12 Jan 2010 05:03:19 GMT</pubDate><guid isPermaLink="false">New Post: Additional Test methods 20100112050319A</guid></item></channel></rss>