Learn how to create a unit test to verify your handling of failure paths.
- [Instructor] So what's expected of some invalid text.…Well, expected is an Outcome.Failure,…and let's for the moment…just hard wire the error message in the test.…We're going to clearly need to call parse to do this test.…So let's say Parse text,…and let's have a little look at the types here.…So expected is an outcome of some type…that the compiler doesn't know about yet.…An actual is a query.…So we're not going to have very good results…when we're comparing.…
We're trying to do an AreEqual on an outcome and a query,…so we really need to make sure…that our Parse thing actually returns an outcome.…So let's move that text to there…and let us make sure that the return type,…let's say let result equals…and then just assign that records,…and now we're going to return a Outcome.Success of result.…
We haven't done the exception unhappy path yet,…but at least that makes the type overs of parse…be an outcome of type query.…Trouble is of course…that this will have broken our first test,…and indeed you can see red all over the place here…
- Defining values and calling functions in F#
- Defining and identifying discriminated unions
- Working with if-else expressions
- Writing unit test
- Using type providers to access data
- Analyzing data with collection functions
- Plotting data using the R type provider
- Using railway-oriented programming to handle errors
- Integrating with Twitter
- Deploying an F# application to Azure
Skill Level Intermediate
1. Get Started with F#
2. Build a Simple Parser with Unit Testing
3. Use F# CSV Type Provider to Get Data
4. Analyze Data with F# Collection Functions
5. Use RStats Provider and ggplot2 to Plot Data
6. Use BoxKite with Twitter
7. Deploy a Working Bot
Next steps1m 46s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.