Learn how to write the code to read one line of text, separate the columns, and attempt to convert each column into the expected data type. Confirm your results using the NFluent library in unit tests.
- [Instructor] In this video, we're going to focus…on processing just one line of text at a time.…Open the Tests_WeatherData source code file.…Double-click Tests_WeatherData…and notice the line 26 where we have ParseLine.…Here, we are looking at a variable text…which we will post to the method called Parse,…and we expect errors to cause exceptions.…In this case, it should parse successfully.…
So, open your Test Explorer Window…and right-click on the ParseLine unit test,…and click Run Selected Tests.…If it turns green, it ran successfully.…Now, this would work for small volumes of data,…but we are going to parse literally hundreds of thousands…of lines of text.…And so, we want a more elegant way of dealing with errors.…In particular, here on line 41 in the next unit test,…we will implement the TryParse method…that will tell us true or false…in terms of the outcome of parsing a line of text.…
So, the WeatherObservation type has a TryParse method…that we will implement,…and we will pass in text string,…but now, if it returns true,…
Skill Level Intermediate
1. Problem 1: Pond Oreille
2. Problem 2: Where Am I?
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Facial Recognition
6. Problem 6: Real-Time Information Dashboard
Next steps2m 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.