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 BDD Behavior Driven Development
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

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

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

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

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

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

Faking the WebApi User
I needed to unit test a WebAPI call in my MVC 4 application that checks the user's role. I'm doing this in my MVC controllers with the following code using FakeItEasy (I should do a post on that sometime): this.UserPrincipalFake = A.Fake<IPrincipal>(); A.CallTo(() => this.UserPrincipalFake.Iden... A.CallTo(() => this.UserPrincipalFake.Iden... this.HttpContextBaseFake = A.Fake<HttpContextBase&g... this.HttpContextBaseFake.User ......

Posted On Wednesday, June 5, 2013 10:29 AM

Jasmine Specification Testing Pointers
I’ve been using Jasmine JavaScript testing library for Behavior Driven Development (see my Benefits of BDD post) testing the last few months with KnockoutJs view models and the Revealing Module Pattern. We now have 244 specs on a system that will be around and hopefully expand. I was hired to get it going, then others will maintain it and add to it after I’m gone. They have helped me think through what needs to happen (when {X} it should do this), test functionality with out having to click through ......

Posted On Friday, April 5, 2013 3:18 PM

Mocking or Faking DbSet
I needed to Fake the DbSet of a DBContext in EF 5 so that I could test my caching implementation. I searched for awhile and found this link on creating an in memory DbSet. I first copied the code in and created an InMemoryDbSet class. Then I changed all my DbSets in my DBContext to IDbSet. Then I was able to mock the call to UserProfiles and return a dummy object. The Test I’m using FakeItEasy which is a nuget packages. Notice the usage of the InMemoryDbSet<UserProfil... [TestInitialize] public ......

Posted On Wednesday, December 12, 2012 11:14 AM

Copyright © Aligned | Powered by: | Join free