Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Because of this, the location SelectList should be defaulted to Location5 when ever a entry screen for a new employee is displayed. Should I be defaulting the location in the model or in the view-model?</p> </blockquote> <p>It's business logic in your example, but that won't stop you from having your cake and eating it too in this instance. The model can specify a default value; the view then initializes itself with this default value.</p> <p>In general, whether or not something is "business logic" or "presentation logic" depends on whether it concerns the domain or not. For instance, setting the earliest year in a date drop-down to, say, 1900 is probably a presentation concern. But it could also be a business concern, if the system isn't designed to accept dates earlier than 1900.</p> <blockquote> <p>One thing I realized is that the unit tests become awkward because in both cases, I'd be forced to test against a location that will always be present in production but I cannot create a unit test with my own test data unless "Atlanta" was in the set of locations being used in the test. I'd be greatful if you have any thoughts on this as well.</p> </blockquote> <p>With the strategy I mentioned above, unit-testing is easy. Simply verify that:</p> <ul> <li>the model provides a default value</li> <li>the view accepts this default value</li> <li>the view initializes itself to this default value</li> <li>the view has the appropriate behavior whether or not the model supplies that value</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload