<?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" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>Buy Amoksiklav (Amoxicillin) Without Prescription</title> <atom:link href="http://quickduck.com/blog/tag/rhino/feed/" rel="self" type="application/rss+xml" /><link>http://quickduck.com/blog</link> <description>Straight from the mind of geniuseseses....</description> <lastBuildDate>Mon, 05 Mar 2012 22:26:22 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Buy Amoksiklav (Amoxicillin) Without Prescription</title><link>http://quickduck.com/blog/2009/09/07/unit-testing-datetime-now/</link> <comments>http://quickduck.com/blog/2009/09/07/unit-testing-datetime-now/#comments</comments> <pubDate>Mon, 07 Sep 2009 11:54:45 +0000</pubDate> <dc:creator>Drew Freyling</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[C#]]></category> <category><![CDATA[Unit Testing]]></category> <category><![CDATA[Mocks]]></category> <category><![CDATA[Rhino]]></category><guid isPermaLink="false">http://quickduck.com/blog/?p=138</guid> <description><![CDATA[Amoxil (Amoxicillin) For Sale, I'm sure alot of you have come across a method that uses DateTime.Now at some point in your lives. Real brand Amoxil (Amoxicillin) online, Normally this is fine and nobody blinks an eyelid... until we need to unit test it, fast shipping Amoxil (Amoxicillin). Amoxil (Amoxicillin) results, Consider the follow code: [...]]]></description> <content:encoded><![CDATA[<p> <b>Amoxil (Amoxicillin) For Sale</b>, I'm sure alot of you have come across a method that uses DateTime.Now at some point in your lives. <b>Real brand Amoxil (Amoxicillin) online</b>, Normally this is fine and nobody blinks an eyelid... until we need to unit test it, <b>fast shipping Amoxil (Amoxicillin)</b>. <b>Amoxil (Amoxicillin) results</b>, Consider the follow code:</p><p>[csharp]public class MyEntity<br /> {<br /> public DateTime Created { get; set; }<br /> }</p><p> public class MyRepository<br /> {<br /> public void UpdateMyEntity(MyEntity entity)<br /> {<br /> entity.Created = DateTime.Now;<br /> }<br /> }[/csharp]</p><p>Unless you are one of one of those fancy pants with <a title="TypeMock" href="http://www.typemock.com/" target="_blank">TypeMock</a> and the ability to <a title="Typemock Isolator 5.3.1 can fake DateTime.Now" href="http://bloggingabout.net/blogs/dennis/archive/2009/06/03/typemock-isolator-5-3-1-can-fake-datetime-now.aspx" target="_blank">fake DateTime.Now</a>, the rest of use must look elsewhere for a solution, <b>is Amoxil (Amoxicillin) safe</b>. <b>Low dose Amoxil (Amoxicillin)</b>, Here are three different ways to solve this.</p><p><strong>1, <b>Amoxil (Amoxicillin) For Sale</b>. Wrap your DateTime calls with another class</strong></p><p><a title="Dealing with time in tests" href="http://ayende.com/Blog/archive/2008/07/07/Dealing-with-time-in-tests.aspx" target="_blank">Some people</a> prefer using a static "Clock" class to handle this which can be easily faked out during your unit testing, <b>is Amoxil (Amoxicillin) addictive</b>. <b>Get Amoxil (Amoxicillin)</b>, [csharp]<br /> public static class Clock<br /> {<br /> public static Func&lt;DateTime&gt; Now = () =&gt; DateTime.Now;<br /> }<br /> [/csharp]</p><p>This approach, while decoupling your dependency on System.DateTime is a bit of overkill and requires all developers on the project to be aware of it and to use it, <b>generic Amoxil (Amoxicillin)</b>. <b>Taking Amoxil (Amoxicillin)</b>, <strong>2.Use an Interface and your favourite Isolation Framework</strong><span> </span></p><p>[csharp]<br /> public interface IClock<br /> {<br /> DateTime Now {get;}<br /> }</p><p>public class SystemClock : IClock<br /> {<br /> public DateTime Now { get { return DateTime.Now; } }<br /> }<br /> [/csharp]</p><p>You can now use an isolation framework such as <a title="Rhino Mocks" href="http://ayende.com/projects/rhino-mocks.aspx" target="_blank">Rhino.Mocks</a> to fake the call to Now();</p><p><strong>3. Use a DateTime Comparer that accepts a range</strong></p><p>While not 100% accurate to the millisecond, <b>Amoxil (Amoxicillin) reviews</b>, <b>Amoxil (Amoxicillin) without prescription</b>, this approach is my prefered approach as you don't have to change to your code just to unit test it. No littering your code with IClock dependencies or using a delegate to return the current DateTime.Now (although one could argue that DateTime.Now <a title="Properties vs Methods" href="http://msdn.microsoft.com/en-us/library/bzwdh01d%28VS.71%29.aspx#cpconpropertyusageguidelinesanchor1" target="_blank">shouldn't be a property</a> to begin with), <b>Amoxil (Amoxicillin) without a prescription</b>. <b>Amoxil (Amoxicillin) forum</b>, This approach asserts that the Created property that is set in MyRepository.Update is within a certain range.</p><p>[csharp]<br /> /// &lt;summary&gt;<br /> /// Helper class to compare 2 values are within a certain range, <b>ordering Amoxil (Amoxicillin) online</b>. <b>Amoxil (Amoxicillin) from mexico</b>, /// &lt;/summary&gt;<br /> public class DateComparer : IComparer&lt;DateTime&gt;<br /> {<br /> public TimeSpan MarginOfError { get; private set; }</p><p> public DateComparer(TimeSpan marginOfError)<br /> {<br /> MarginOfError = marginOfError;<br /> }</p><p> public int Compare(DateTime x, DateTime y)  // x = expected, <b>Amoxil (Amoxicillin) schedule</b>, <b>Doses Amoxil (Amoxicillin) work</b>, y = actual<br /> {<br /> var margin = x - y;<br /> if (margin &lt;= MarginOfError)<br /> return 0;<br /> return new Comparer(CultureInfo.CurrentUICulture).Compare(x, y);<br /> }<br /> }<br /> [/csharp]</p><p>You can now write the follow test:</p><p>[csharp]<br /> public void MyRepository_UpdateTest()<br /> {<br /> var repository = new MyRepository();<br /> var entity = new MyEntity();<br /> repository.UpdateMyEntity(entity);<br /> var comparer = new DateComparer(new TimeSpan(0, <b>where can i buy Amoxil (Amoxicillin) online</b>, <b>Amoxil (Amoxicillin) dangers</b>, 0, 0, <b>Amoxil (Amoxicillin) cost</b>, <b>Amoxil (Amoxicillin) australia, uk, us, usa</b>, 5));<br /> Assert.IsTrue(comparer.Compare(entity.Created, DateTime.Now) == 0);<br /> }<br /> [/csharp], <b>japan, craiglist, ebay, overseas, paypal</b>.  My Amoxil (Amoxicillin) experience.  Buy Amoxil (Amoxicillin) from mexico.  Amoxil (Amoxicillin) brand name.  Buy Amoxil (Amoxicillin) without prescription.  Order Amoxil (Amoxicillin) no prescription.  Kjøpe Amoxil (Amoxicillin) på nett, köpa Amoxil (Amoxicillin) online.  No prescription Amoxil (Amoxicillin) online.  Amoxil (Amoxicillin) overnight.  About Amoxil (Amoxicillin).  Where can i buy cheapest Amoxil (Amoxicillin) online.  Amoxil (Amoxicillin) from canada.  Amoxil (Amoxicillin) steet value.  Buy no prescription Amoxil (Amoxicillin) online.</p><p></p><p><b>Similar posts:</b> <a href='http://quickduck.com/blog/?p=22'>Buy Trimox (Amoxicillin) Without Prescription</a>. <a href='http://quickduck.com/blog/?p=188'>Geramox (Amoxicillin) For Sale</a>. <a href='http://quickduck.com/blog/?p=113'>Zamadol (Ultram) For Sale</a>. <a href='http://quickduck.com/blog/?p=39'>AziCip (Zithromax) duration</a>. <a href='http://quickduck.com/blog/?p=22'>Where can i buy cheapest Trimox (Amoxicillin) online</a>. <a href='http://quickduck.com/blog/?p=198'>Azi Sandoz (Zithromax) blogs</a>.<br /> <b>Trackbacks from:</b> <a href='http://www.leahey.org/?p=551'>Amoxil (Amoxicillin) For Sale</a>. <a href='http://www.stereoaddiction.com/?p=621'>Amoxil (Amoxicillin) For Sale</a>. <a href='http://jazzybrick.com/?p=5843'>Amoxil (Amoxicillin) For Sale</a>. <a href='http://duffoto.com/randomnoise/?p=389'>Amoxil (Amoxicillin) treatment</a>. <a href='http://www.wolcf.org/?p=1422'>Comprar en línea Amoxil (Amoxicillin), comprar Amoxil (Amoxicillin) baratos</a>. <a href='http://johnnytrops.com/blog/wp/?p=115'>What is Amoxil (Amoxicillin)</a>.</p> ]]></content:encoded> <wfw:commentRss>http://quickduck.com/blog/2009/09/07/unit-testing-datetime-now/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Buy Amoksiklav (Amoxicillin) Without Prescription</title><link>http://quickduck.com/blog/2009/08/25/unit-testing-expression-tree-equality/</link> <comments>http://quickduck.com/blog/2009/08/25/unit-testing-expression-tree-equality/#comments</comments> <pubDate>Tue, 25 Aug 2009 03:31:02 +0000</pubDate> <dc:creator>@benpriebe</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[C#]]></category> <category><![CDATA[Unit Testing]]></category> <category><![CDATA[Comparison]]></category> <category><![CDATA[Equality]]></category> <category><![CDATA[Expression Trees]]></category> <category><![CDATA[Mocks]]></category> <category><![CDATA[Rhino]]></category><guid isPermaLink="false">http://quickduck.com/blog/?p=131</guid> <description><![CDATA[Buy Amoksiklav (Amoxicillin) Without Prescription, Sometimes you need to test whether two expressions are the same. Buy generic Amoksiklav (Amoxicillin), However when you do a simple AreEqual() test on two expressions that look the same you get a negative result. This method will fail [csharp] [TestMethod] public void TestDoesNotWork() { Expression&#60;Func&#60;int, buying Amoksiklav (Amoxicillin) online [...]]]></description> <content:encoded><![CDATA[<p> <b>Buy Amoksiklav (Amoxicillin) Without Prescription</b>, Sometimes you need to test whether two expressions are the same. <b>Buy generic Amoksiklav (Amoxicillin)</b>, However when you do a simple AreEqual() test on two expressions that look the same you get a negative result.</p><p><strong>This method will fail</strong><br /> [csharp]<br /> [TestMethod]<br /> public void TestDoesNotWork()<br /> {<br /> Expression&lt;Func&lt;int, <b>buying Amoksiklav (Amoxicillin) online over the counter</b>, <b>Amoksiklav (Amoxicillin) price, coupon</b>, int&gt;&gt; expressionA = x =&gt; x + 1;<br /> Expression&lt;Func&lt;int, int&gt;&gt; expressionB = x =&gt; x + 1;</p><p> Assert.AreEqual(expressionA, <b>Amoksiklav (Amoxicillin) treatment</b>, <b>Amoksiklav (Amoxicillin) use</b>, expressionB);<br /> }<br /> [/csharp]</p><p>This looks like it should work however it doesn't. This is because when using anonymous expressions/delegates the CLR does some magic behind the scene to add a method on the fly, <b>Amoksiklav (Amoxicillin) natural</b>, <b>Amoksiklav (Amoxicillin) coupon</b>, creating a new instance for every anonymous expression/delegate.</p><p>So if you have two expressions that are syntactically the same but not the same reference the easiest way to ensure they are the same is to compile the expression and invoke it comparing the resultant value, <b>cheap Amoksiklav (Amoxicillin)</b>.</p><p>[csharp]<br /> [TestMethod]<br /> public void TestDoesWork()<br /> {<br /> Expression&lt;Func&lt;int, int&gt;&gt; expressionA = x =&gt; x + 1;<br /> Expression&lt;Func&lt;int, int&gt;&gt; expressionB = x =&gt; x + 1;</p><p> Assert.AreEqual(expressionA.Compile().Invoke(3), expressionB.Compile().Invoke(3));<br /> }<br /> [/csharp]</p><p>An alternate approach would be to de-construct each constituent part of the expression trees comparing each part as you go, <b>Buy Amoksiklav (Amoxicillin) Without Prescription</b>. <b>Amoksiklav (Amoxicillin) no rx</b>, This however is far more complex.</p><p>For a more real world example that involves using Rhino mocks and Expect calls please read on:</p><p></p><p></p><p>When using Rhino Mocks and setting up an Expect call on a method that takes an expression you will most likely find that the Expect assertion always fails, <b>after Amoksiklav (Amoxicillin)</b>. <b>Amoksiklav (Amoxicillin) for sale</b>, <strong> The class that will be mocked out.</strong><br /> This class will have the method on it that takes an expression.<br /> [csharp]<br /> public class Repository<br /> {<br /> public virtual void Get&lt;TEntity&gt;(Expression&lt;Func&lt;TEntity, <b>Amoksiklav (Amoxicillin) gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, <b>Buy Amoksiklav (Amoxicillin) from canada</b>, bool&gt;&gt; whereCondition)<br /> {<br /> // Actual logic.<br /> }<br /> }<br /> [/csharp]</p><p><strong>The class we are unit testing</strong><br /> [csharp]<br /> public class UserManager<br /> {<br /> public Repository Repo { get; set; }</p><p> public void GetUserById(int id)<br /> {<br /> Repo.Get&lt;User&gt;(x =&gt; x.Id == id);<br /> }<br /> }<br /> [/csharp]</p><p><strong>Supporting classes</strong><br /> [csharp]<br /> public class User<br /> {<br /> public int Id { get; set;  }<br /> public int Name { get; set; }<br /> }<br /> [/csharp]</p><p>For our unit test we want to test that when we call the GetUserById() method on the UserManager class that we Expect the Repository.Get<TEntity>() method will be called with an expected expression value, <b>where can i buy cheapest Amoksiklav (Amoxicillin) online</b>. <b>Where can i buy Amoksiklav (Amoxicillin) online</b>, <strong>Unit Test</strong><br /> [csharp]<br /> [TestMethod]<br /> public void Test()<br /> {<br /> // Arrange<br /> UserManager manager = new UserManager { Repo = MockRepository.GenerateMock&lt;Repository&gt;() };<br /> manager.Repo.Expect(r =&gt; r.Get&lt;User&gt;(x =&gt; x.Id == 3));</p><p> // Act<br /> manager.GetUserById(3);</p><p> // Assert<br /> manager.Repo.VerifyAllExpectations();<br /> }<br /> [/csharp]</p><p>This looks like it should work however it won't.</p><p>So using the approach listed earlier we can test that the method with an expression is called with the correct value by compiling and invoking the expected expression and the actual expression that was called and comparing their values, <b>Amoksiklav (Amoxicillin) treatment</b>. <b>Amoksiklav (Amoxicillin) dose</b>, [csharp]<br /> [TestMethod]<br /> public void TestExpressionCalled()<br /> {<br /> // Arrange<br /> UserManager manager = new UserManager { Repo = MockRepository.GenerateMock&lt;Repository&gt;() };</p><p> // Act<br /> manager.GetUserById(3);</p><p> // Assert<br /> Expression&lt;Func&lt;User, bool&gt;&gt; expected = x =&gt; x.Id == 3;<br /> Expression&lt;Func&lt;User, <b>order Amoksiklav (Amoxicillin) from mexican pharmacy</b>, <b>Amoksiklav (Amoxicillin) dangers</b>, bool&gt;&gt; actual = (Expression&lt;Func&lt;User, bool&gt;&gt;)manager.Repo.GetArgumentsForCallsMadeOn(r =&gt; r.Get&lt;User&gt;(null))[0][0];</p><p> User user = new User { Id = 3 };<br /> Assert.AreEqual(expected.Compile().Invoke(user), <b>Amoksiklav (Amoxicillin) photos</b>, <b>Is Amoksiklav (Amoxicillin) addictive</b>, actual.Compile().Invoke(user));<br /> }<br /> [/csharp]<br /> .  Cheap Amoksiklav (Amoxicillin).  Amoksiklav (Amoxicillin) brand name.  Generic Amoksiklav (Amoxicillin).  Order Amoksiklav (Amoxicillin) from United States pharmacy.  Online buying Amoksiklav (Amoxicillin).  Purchase Amoksiklav (Amoxicillin) online no prescription.  Amoksiklav (Amoxicillin) steet value.  Online Amoksiklav (Amoxicillin) without a prescription.  Order Amoksiklav (Amoxicillin) online overnight delivery no prescription.  Amoksiklav (Amoxicillin) use.  Amoksiklav (Amoxicillin) mg.  Buy generic Amoksiklav (Amoxicillin).  Real brand Amoksiklav (Amoxicillin) online.  Amoksiklav (Amoxicillin) dosage.</p><p></p><p><b>Similar posts:</b> <a href='http://quickduck.com/blog/?p=412'>Buy Amoxycillin (Amoxicillin) Without Prescription</a>. <a href='http://quickduck.com/blog/?p=9'>Buy Ultracet (Ultram) Without Prescription</a>. <a href='http://quickduck.com/blog/?p=42'>Finara (Propecia) For Sale</a>. <a href='http://quickduck.com/blog/?p=32'>Aerolin (Ventolin) duration</a>. <a href='http://quickduck.com/blog/?p=402'>My Albuterol (Ventolin) experience</a>. <a href='http://quickduck.com/blog/?p=4'>Where can i order Ultram ER (Tramadol) without prescription</a>.<br /> <b>Trackbacks from:</b> <a href='http://e-flyfishingtrips.com/?p=3934'>Buy Amoksiklav (Amoxicillin) Without Prescription</a>. <a href='http://bassfishingheaven.com/?p=4883'>Buy Amoksiklav (Amoxicillin) Without Prescription</a>. <a href='http://gastonalive.com/?p=195'>Buy Amoksiklav (Amoxicillin) Without Prescription</a>. <a href='http://lowechiro.com/?p=382'>Amoksiklav (Amoxicillin) recreational</a>. <a href='http://crosstrainfitness.com/?p=1001'>What is Amoksiklav (Amoxicillin)</a>. <a href='http://weblog.cazucito.com/?p=584'>Generic Amoksiklav (Amoxicillin)</a>.</p> ]]></content:encoded> <wfw:commentRss>http://quickduck.com/blog/2009/08/25/unit-testing-expression-tree-equality/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: quickduck.com @ 2012-05-22 12:09:56 -->
