<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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/"
> <channel><title>Comments on: How to Apply the Single Responsibility Principle to View Models in Silverlight and WPF</title> <atom:link href="http://www.arrangeactassert.com/how-to-apply-the-single-responsibility-principle-to-view-models-in-silverlight-and-wpf/feed/" rel="self" type="application/rss+xml" /><link>http://www.arrangeactassert.com/how-to-apply-the-single-responsibility-principle-to-view-models-in-silverlight-and-wpf/</link> <description>Jag Reehal on Agile Development, ASP.NET MVC and all manner of good stuff</description> <lastBuildDate>Sun, 29 Jan 2012 22:29:00 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>By: Anonymous</title><link>http://www.arrangeactassert.com/how-to-apply-the-single-responsibility-principle-to-view-models-in-silverlight-and-wpf/#comment-243</link> <dc:creator>Anonymous</dc:creator> <pubDate>Wed, 20 Apr 2011 19:30:00 +0000</pubDate> <guid
isPermaLink="false">http://www.arrangeactassert.com/?p=828#comment-243</guid> <description>Andrew,Yes I could have added (injected) in something else into the ViewModel that would be invoked when the calculate button was clicked on.For the example used in the post adding this would have been overkill.If you do inject something in to do the calculation, I would write a test to assert it was called when the calculate button was clicked, but wouldn’t test what should do in the same unit tests for the ViewModel.</description> <content:encoded><![CDATA[<p>Andrew,</p><p>Yes I could have added (injected) in something else into the ViewModel that would be invoked when the calculate button was clicked on.</p><p>For the example used in the post adding this would have been overkill.</p><p>If you do inject something in to do the calculation, I would write a test to assert it was called when the calculate button was clicked, but wouldn’t test what should do in the same unit tests for the ViewModel.</p> ]]></content:encoded> </item> <item><title>By: Andrew Hanson</title><link>http://www.arrangeactassert.com/how-to-apply-the-single-responsibility-principle-to-view-models-in-silverlight-and-wpf/#comment-237</link> <dc:creator>Andrew Hanson</dc:creator> <pubDate>Fri, 08 Apr 2011 17:51:00 +0000</pubDate> <guid
isPermaLink="false">http://www.arrangeactassert.com/?p=828#comment-237</guid> <description>Forgive the comment on an old post, but I&#039;m sort of struggling with this exact problem right now and had a question for you.  I&#039;m sold on the single responsibility importance, and everything so no argument there.  My question is how does this new Calculator object fit into the overall hierarchy of the application.
Let&#039;s assume the application you are describing above had a form with a button and when the button was clicked somehow the calculator object needs to be instantiated, and the add method called with the first value and second value properties of the view model with the result being stored in the result property of the view model.
Your button click is bound to a routed command of some kind, so my question is where does this routed command go?  If it goes to the View Model, you&#039;re still tying a dependency between the view model and the calculator object.  It would be better if the view model and calculator objects knew nothing of each other. I just can&#039;t resolve where my command should be handled so my View Model and my Logic objects are both testable.</description> <content:encoded><![CDATA[<p>Forgive the comment on an old post, but I&#8217;m sort of struggling with this exact problem right now and had a question for you.  I&#8217;m sold on the single responsibility importance, and everything so no argument there.  My question is how does this new Calculator object fit into the overall hierarchy of the application.<br
/> Let&#8217;s assume the application you are describing above had a form with a button and when the button was clicked somehow the calculator object needs to be instantiated, and the add method called with the first value and second value properties of the view model with the result being stored in the result property of the view model.<br
/> Your button click is bound to a routed command of some kind, so my question is where does this routed command go?  If it goes to the View Model, you&#8217;re still tying a dependency between the view model and the calculator object.  It would be better if the view model and calculator objects knew nothing of each other. I just can&#8217;t resolve where my command should be handled so my View Model and my Logic objects are both testable.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Served from: www.arrangeactassert.com @ 2012-02-06 00:44:39 by W3 Total Cache -->
