Geeks With Blogs

News profile for Aligned at Stack Overflow, Q&A for professional and enthusiast programmers

Donate Bitcoins

Check out Elapser from T3rse!
"free in Christ Jesus from the law of sin and death." Romans 8:2 (ESV) Check out the Falling Plates video on YouTube.
more about the Gospel
And then listen to Francis Chan speaking at LifeLight in SD.

Programming and Learning from SD Unit Testing
Checking the Status of a Cloud Service with Azure Management API
We are automatically deploying a package to Azure, then running tests against that instance. See Brady Gaster’s article for more details. I needed a way to make sure the deployment was complete, and if not wait for it. After digging through the objects with Intellisense, we found this solution:public bool IsCloudServiceRunning() { var details = _computeManagementClient.Ho... var deployment = details.Deployments.First(d => d.Name == _parameters.CloudServiceName ......

Posted On Thursday, September 18, 2014 12:37 PM

Dependency Injection Interview Video
In the video from Visual Studio Magazine with Miguel Castro who has some interesting things to say about Dependency Injection and Unit Testing. "It should be mainstream". "no longer do we new objects up, now = new this()". "this [new objects] used to be a no-brainer... until all of a sudden Unit testing hit the world by storm" "#1 reason for this is so we can test properly""You're writing untestable code [without DI]" "I'm a consultant, so I need to leave something maintainable and tested" ~ talking ......

Posted On Thursday, September 19, 2013 4:05 PM

Benefits of Behavior Driven Development
Continuing my previous article on BDD, I wanted to point out some benefits of BDD and since BDD is an extension of Test Driven Development (TDD), you get those as well. I’ll add another article on some possible downsides of this approach. There are many articles about the benefits of TDD and they apply to BDD. I’ve pointed out some here and copied some of the main points for each article, but there are many more including the book The Art of Unit Testing by Roy Osherove. ......

Posted On Friday, July 26, 2013 10:44 AM

Get a new instance with StructureMap
It took me too long to figure this out, so hopefully it will help you. StructureMap has way that will create a new instance of the object every time, instead of storing this in the container. I’m going to use this for the DBContext and for WCF Service references. Since the ObjectFactory is a static class, MVC will have these stored in memory without this. Credit goes to Joshua Flanagan for answering my question.[TestMethod] public void GetConcreteInstanceOf_Shoul... { ObjectFactory.Initialize(re... ......

Posted On Thursday, November 29, 2012 10:44 AM

Mock the window.setTimeout in a Jasmine test to avoid waiting
Jasmine has a clock mocking feature, but I was unable to make it work in a function that I’m calling and want to test. The example only shows using clock for a setTimeout in the spec tests and I couldn’t find a good example. Here is my current and slightly limited approach. If we have a method we want to test: var test = function(){ var self = this; self.timeoutWasCalled = false; self.testWithTimeout = function(){ window.setTimeout(function(){ self.timeoutWasCalled = true; }, 6000); }; }; Here’s ......

Posted On Thursday, August 21, 2014 4:42 PM

Getting Started with Behavior Driven Development
In this post, I wanted to share some thoughts and resources that I’ve collected since learning about Behavior Driven Development (BDD) (as of June 2013). Thinking in BDD terms has really helped me in improving my software development and thinking through problems. I remember a day when it clicked. It was an exciting time for me and I don’t planning on going back to the old approach. My tendency is to dive into the code before thinking through things and that gets me into trouble. I’m also an optimistic ......

Posted On Tuesday, June 11, 2013 10:18 AM

Mock RequireJS define dependencies with
I had a module dependency, that I’m pulling down with RequireJS that I needed to use and write tests against. In this case, I don’t care about the actual implementation of the module (it’s simple enough that I’m just avoiding some AJAX calls). EDIT: make sure you look at the bottom example after the edit before using the approach. I found that there is an easier way. I did not want to change the constructor of the consumer as I had a chain of changes that would have to be made and that ......

Posted On Monday, August 18, 2014 4:53 PM

Use Selenium to Find Elements By Knockout’s Data-bind
I created a quick C# extension method for Selenium to find an element by its data-bind attribute. I wanted to find an element by the binding instead of having to add a class or id to the element. If you have a Knockout Model function MyViewModel() { “use strict”; = ko.observable(); } In the html the element may look like this <input id="nameInput" data-bind="text: name" /> <div id="infoContainer"> <span data-bind=”text: name” /> </div> With the extension method I ......

Posted On Wednesday, July 9, 2014 11:14 AM

A few hints to get started with writing code to test your code
I’ve talked about and shown examples of testing with code (we usually say Unit testing) with fellow developers, but it seems that there is always a barrier to getting started. Here are some of my thoughts on helping you get past that barrier. Notice that I avoided “Unit testing” in my title. I break testing with code into several categories, that help me think and talk about testing. Unit Functionality of test directly, with dependencies removed through mocks or fakes. Behavior (BDD) Test the expected ......

Posted On Friday, May 2, 2014 4:42 PM

Thinking about Productive Work as a Software Developer
Since I started my career as a Software Developer about 7 years ago, I’ve realized that perception of what a valuable use of my time while at work has changed. Scott Hanselman blogged his productivity tips which got me thinking about this more. Meetings I have many times grumbled when a new meeting pops up in Outlook. I have been a part of a lot of time wasting meetings, but there are several that are very useful. Daily stand ups or Scrums are essential to keep everyone on the same page. Retrospectives ......

Posted On Thursday, April 3, 2014 11:57 AM

Copyright © Aligned | Powered by: | Join free