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
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

Mock RequireJS define dependencies with config.map
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 config.map 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”; this.name = 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

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. http://geekswithblogs.net/l... ......

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

Notes from Jan 09, 2014 LIDNUG TDD, Where did it all go Wrong
I recently was asked by a co-worker to watch Ian Cooper talk about TDD to give my take on Mr. Cooper’s presentation on TDD. Here’s what I sent back and decided to share it with all of you as well. He's got a lot of experience and laid out things are often stated as things against TDD. Even mentions SpecFlow and problems he had with that. This turns out to validate some of my ideas on BDD. Interesting talk about refactoring too (write code quick, then refactor and write clean code). I'd suggest that ......

Posted On Monday, February 10, 2014 2:21 PM

Steps to Get MVC running with Ninject
enable package restore on solution Nuget Ninject.MVC3 (pre-release available?) * adds Ninject, Ninject.Web.Common, Ninject.Web.Mvc * App_Start/NinjectWebCommon.cs -> has WebActivator.PreApplication... attribute -> runs at startup add interface and class for testing (IBikeManager and BikeManager) add controller constructor to HomeController that takes in the interface - run website => Error "Error activating IBikeManager No matching bindings are available, and the type is not self-bindable. ......

Posted On Wednesday, November 20, 2013 10:46 AM

Heartland Developers Conference 2013 Highlights
I was able to go to another great year of HDC 13 at the beginning of September (on Twitter #hdc13). Our company sent 8 of us down for the Thursday and Friday (thanks for investing in us!). The main theme I got from the conference was to get out and build an app or with the “internet of things” figure out how things work and look into Arduino and connecting for outside control. How do we use of skills for good as well? The Bing platform looks very promising. There were also some Windows 8.1 demos ......

Posted On Wednesday, October 2, 2013 11:20 AM

Copyright © Aligned | Powered by: GeeksWithBlogs.net | Join free