Until now, our tests have focused on the model, Projects. The point of MVVM, however, is to enable sufficient separation of concerns to allow testing of the program’s logic in the ViewModel.
Today, we turn to ViewModel tests, using these tests both to drive the development of the ViewModel, and also to ensure the integrity and correctness of the logic as we refactor the code.
In the previous posting, I set up the ProjectTracker solution, including the xUnit testing folders. We talk a lot about test-driven design, but the truth is that we (most of us?) start with an overall architecture in mind prior to writing anything.
For ProjectTracker, I know I’m going to have a project model, and I know that it will contain a name and a way to get the total duration of work on the project, as well as “segments” which will hold each “chunk” of work.
I also know that I’ll have multiple projects but that at most one will be active at a time.
Now, the specifics of how to put that into code… well that I’m going to determine test-first:
Last week we decided to start with test-first development using XUnit. To
get underway, let’s create a new Xamarin.Forms application called BlogProjectTracker.
Once the projects are created we’ll return to the solution and add a new .NET project of type Portable Library which we’ll call BlogProjectTracker.Tests.
Finally, we’ll add an empty iOS project which will be used as the test runner, and which we’ll call BlogProjectTracker.Tests.iOS. We can then do the same for Android calling the new project BlogProjectTracker.Tests.Droid
Incredibly excited to announce my latest Pluralsight Course: Beginning Mobile Development with Xamarin.
In this course, you will build a real-world application three times, using three different Xamarin platforms, giving you tremendous insight into how Xamarin programs are created and how they relate to the underlying technologies. This course covers creating the user interface, the data model, and the logic of the program. Data and Event Handling are key parts of this course, as is persistence to a SQLite database.
I started programming in 1971, but didn’t much like it and didn’t start professional programming until 1985. I’d be very interested in when you started, and what languages you used since then (languages you used to write something meaningful) Here is most of my list (the ones in bold I used to write commercial applications)
For the past four weeks, we’ve been reviewing the fundamentals of Xamarin. Let’s stop for a bit and talk about how we really code, and how we should.
In my Pluralsight courses, I take you through each skill, step by step, but here I’d like to try giving you a lot of information at once, and see what comments you leave about the pace and quantity of information.
So let’s start a new project, not unlike the previous, but this time we’re going to build it out using unit tests and all the goodies of a real application. Again, fasten your seatbelts because we’re going to cover a lot of ground quickly.
This week we’ll save the Tasks in memory, in coming weeks we’ll review databinding and we’ll review the tasks in a bound list.
NB: We’re moving very quickly through the preliminaries, so please do use the comments to ask questions or let me know where there are areas of confusion.
The first job is to create a task model: a class whose instances can each represent one task.
Zero hype. Free means free.
Sign up for FalafelCon (Monterey, September 14-17) and you not only get full admission to all of FalafelCon and all of TechIntersection, but under this special deal you get the IOT workshop by Doug Seven ( all day Monday) and my Xamarin workshop (all day Friday) free.
(Or if you prefer, pay for both and get a Surface 3)
|This deal is so new, and so crazy that you can’t sign up for it online. You have to call: 203-264-8220 and say you want “Jesse’s deal.” They’ll sign you up!
This week, Greg Shackles: mobile expert and Xamarin MVP; host of Gone Mobile Podcast.
Listen | Yet Another Podcast
In this, week 3 of 52 Weeks of Xamarin, we’re going to pick up where we left off last week, and add event handling to our buttons
There is much to do to make this a working program, and starting next week we’ll begin to add real logic, as well as a Model class (data) and a ViewModel class (logic). We’ll also begin to add unit tests, and shoot for test-driven development.
But I did promise to illustrate how event handling works, and so this week I’ll show how to respond to a button press. This is very simple, which means this week’s posting will be a bit short.
This week we have J Tower, Telerik Expert, Community Organizer, Itinerant Consultant
Listen | Yet Another Podcast
Posted in Essentials
This is the second week of 52 weeks of Xamarin. To make this all more interesting and practical, we’ll start on building a quasi-real-world application; the iconic To Do List.
The application shown in this and future columns is based on an application I explore in depth in my forthcoming Pluralsight course, Beginning Mobile Development with Xamarin
Step 1 is to open a new project. Choose Cross-platform App/ Blank Xamarin.Forms App, and name it 52ToDo. As you work your way through the configuration wizard be sure that Use Portable Class Library is selected.