Comments for PowerShell.org https://powershell.org Wed, 28 Sep 2016 17:21:46 +0000 hourly 1 https://wordpress.org/?v=4.6 Comment on Automate Bootable USB creation with Powershell–Part 2 by Jayaram Krishnaswamy https://powershell.org/2013/07/15/automate-bootable-usb-creation-with-powershellpart-2/#comment-12178 Wed, 28 Sep 2016 17:21:46 +0000 http://powershell.org/?p=8480#comment-12178 Can you write scripts to repair a dvd drive which exists but not recognized by the OS?

]]>
Comment on Unit Testing is “Pestering” the Hell Out Of Me by Jake Ballard https://powershell.org/2016/09/02/unit-testing-is-pestering-the-hell-out-of-me/#comment-12169 Tue, 27 Sep 2016 22:45:06 +0000 https://powershell.org/?p=53248#comment-12169 With Pester I focus on testing behavior not logic. Consider when you want to use a function, you need to know what parameters to give it to get the desired outcome. You don't have to know how it arrives at the outcome, just that it does.

Think of your function as an API, the parameters and your return value are your contract with the customer. Your tests are to prevent the introduction of breaking API changes.

Changing your mindset to focus on the inputs and outputs of your function allows you to stop worrying about testing every line of code inside the function. Instead focus on testing that it accepts the parameters and types of objects you want, and returns the expected results.

This will simplify your tests greatly and make them less fragile when refactoring. I have also found writing tests this way helps me be much better at segregating concerns. A function should generally do a Thing, if it's doing many Things it will be harder to test, which will prompt you to separate each Thing into it's own function. Then you will be able to rely on piping functions together, instead of writing a function that just brings other functions together.

When functions have limited concerns and stable API's that are easily piped together, you reduce the need to embed external functions. This greatly reduces the need for mocks. Be balanced in your use of mocks, to many can make you blind to breaking changes, and add complexity. They are best used for preventing functions from make changes and to limit the delay that would be introduced by functions that work with an external system (such as a database, web service, or directory). When you are mocking a function that you will be passing values to, it is helpful to test that your function is passing the desired values.

]]>
Comment on Microsoft did WHAT? by Stefan Werner https://powershell.org/2016/08/23/microsoft-did-what/#comment-12159 Mon, 26 Sep 2016 18:56:16 +0000 https://powershell.org/?p=51548#comment-12159 I'd recommend SaltStack over Ansible. 😉

]]>
Comment on Philadelphia PowerShell User Group Meeting - October 6th 2016 with Warren Frame by John Mello https://powershell.org/events/philadelphia-powershell-user-group-meeting-october-6th-2016-with-warren-frame/#comment-12151 Sat, 24 Sep 2016 21:04:44 +0000 https://powershell.org/?post_type=event&p=54356#comment-12151 Yes we do! Each meeting is also presented online via Skype For Business and if the recording goes well it also goes on our You Tube Channel : https://www.youtube.com/channel/UCAc_ow5FIJtRpvew__9Iqzg

]]>
Comment on Philadelphia PowerShell User Group Meeting - October 6th 2016 with Warren Frame by Andy https://powershell.org/events/philadelphia-powershell-user-group-meeting-october-6th-2016-with-warren-frame/#comment-12149 Sat, 24 Sep 2016 06:22:16 +0000 https://powershell.org/?post_type=event&p=54356#comment-12149 Do any of these events get recorded or streamed?

Thanks

Andy

]]>
Comment on PowerShell Happenings at Ignite 2016 by Don Jones https://powershell.org/2016/09/22/powershell-happenings-at-ignite-2016/#comment-12139 Fri, 23 Sep 2016 16:25:36 +0000 https://powershell.org/?p=54438#comment-12139 Yeah ;).

]]>
Comment on PowerShell Happenings at Ignite 2016 by Jonathan Walz https://powershell.org/2016/09/22/powershell-happenings-at-ignite-2016/#comment-12136 Fri, 23 Sep 2016 11:32:28 +0000 https://powershell.org/?p=54438#comment-12136 You may want to change it from 2017 to 2016.

Thanks

]]>
Comment on Why "Objects," Remoting, and Consistency are Such a Big Deal in PowerShell by objects-inside https://powershell.org/2016/08/22/why-objects-remoting-and-consistency-are-such-a-big-deal-in-powershell/#comment-12135 Fri, 23 Sep 2016 05:38:13 +0000 https://powershell.org/?p=51512#comment-12135 "Anyone approaching PowerShell for the first time can understand what makes it different, and decide for themselves if they think that's worth an investment to learn to use PowerShell well"

Good Mentoring , Writeup.

]]>
Comment on PowerShell Happenings at Ignite 2016 by Stephen Owen https://powershell.org/2016/09/22/powershell-happenings-at-ignite-2016/#comment-12129 Thu, 22 Sep 2016 16:00:05 +0000 https://powershell.org/?p=54438#comment-12129 I'm looking forward to my session! If you're in Ignite, swing by to see one of my three Intro to PowerShell Sessions. It promises to be demo driven, fast and fun!

]]>
Comment on Regular Expressions are a -replace's best friend by dragon788 https://powershell.org/2013/08/29/regular-expressions-are-a-replaces-best-friend/#comment-12114 Tue, 20 Sep 2016 19:46:12 +0000 http://powershell.org/?p=9755#comment-12114 Thanks David, I was really sweating having to figure out nesting quotes to get a match and an arbitrary string in my replace, you saved me the headache of testing the many variants.

]]>