Test-Driven Development with F#

Learn how the intersection between Test-Driven Development and F# presents opportunities for better design and better testability.
Course info
Rating
(106)
Level
Intermediate
Updated
May 6, 2015
Duration
2h 17m
Table of contents
Description
Course info
Rating
(106)
Level
Intermediate
Updated
May 6, 2015
Duration
2h 17m
Description

In this course, you'll learn about some of the problems associated with mainstream Test-driven Development (TDD), and how working in F# enables you to use TDD without compromising the design of your code. You'll learn how to write tests first in F#, how to build a complete system out of small, isolated functions, and finally see how to express test cases as properties instead of examples.

About the author
About the author

Mark Seemann is the author of Dependency Injection in .NET and the inventor of AutoFixture. He is a professional programmer and software architect living in Copenhagen, Denmark, and currently an independent advisor. He enjoys reading, drawing, playing the guitar, good wine, and gourmet food.

More from the author
Type-Driven Development with F#
Intermediate
3h 56m
Jul 17, 2015
Introduction to Property-based Testing with F#
Intermediate
1h 34m
Apr 17, 2015
More courses by Mark Seemann
Section Introduction Transcripts
Section Introduction Transcripts

From OOP to FP
Hello, my name is Mark Seemann and this is the Test-Driven Development with F# course, module two, From OOP to FP. In this course, you'll learn about the relationship between functional programming and unit testing and, particularly why functional programming reduces the need for mocks. Since F# is based on the object-oriented. NET Framework, you'll often need to interoperate with or live inside of object-oriented frameworks. In this module, you'll also see an example of how to break out of such object-oriented code so that you can design your implementation in a nice, functional way.

Functional TDD
Hello, my name is Mark Seemann and this is the Test-Driven Development with F# course, module three, Functional TDD. In this module, you'll see examples of how to use test-driven development with functional programming. In the previous module, you saw how to escape from the object-oriented nature of most of. NET. In this module, you'll see how to use functional programming with TDD. First, we'll continue with the demos picking up where we left in module two. In the first demo, you'll see how to address validation in a clean, functional way. In the second demo, you'll see how to implement the business rule that you must only accept the reservation if you have available seats. After these two demos, we'll take a step back and look at an important concept called isolation. Understanding isolation enables us to understand the reason why well-designed functions are inheritantly testable, and thus why TDD doesn't lead to test-induced damage with functional programming.

Putting It All Together
Hello, my name is Mark Seemann and this is the Test-Driven Development with F# course, module four, Putting It All Together. In the previous two modules, you saw how to approach functional TDD with F#. In this module, you'll see how to put together those small independent functions. It's my conviction that you learn better from examples than from theory, so most of this module is going to be a series of demos. In the first demo, you'll see how to circle back to the object-oriented Web API controller to add appropriate error handling. In the second demo, you'll see how to implement data access against SQL Server. In the third demo, you'll see how to compose it all into a piece of working software. And in the fourth and final demo, you'll see how to refactor the unit tests into property-based tests.