Mocking Framework for Windows Store apps (and Windows Phone)

With Windows Store apps there are challenges getting traditional mocking frameworks such as Rhino and Moq working due to limited reflection support in the platform (presumably for security reasons).

I wrote a mocking solution when Windows Phone 7 first came out, it can also be used for Windows Store apps. I’ve updated the NuGet descriptions etc. to reflect this.

How To Do TDD with Mocking in Windows Store Apps

Create a new (C#/XAML) Windows Store app project in Visual Studio called “MyAwesomeApp”.

Create your test project “MyAwesomeApp.Tests” and reference your main app.

initsolutionshot

In the main app project, install the MoqaLate NuGet package.  When the package is installed you will have a new folder in the main app solution called “MoqaLateCommandLine”:

moqalteinstalled

(Inside this folder is a readmexxx.txt file with some additional info)

More...

SHARE:

Introducing InAppPurchaseToggle for Windows Store In App Purchase

I just released version 2 of a new open source project called InAppPurchaseToggle.

It simplifies querying if the current user has paid for a particular in-app-purchase (IAP).

It’s convention based and allows creation of strongly-typed objects to represent each IAP offer that you’ve configured in the win8 dev dashboard for your app.

How To Use (updated for v2.0.0)

Create a new Windows Store app project (C#/XAML)in Visual Studio.

Install the NuGet package InAppPurchaseToggle.

Currently the package just installs the source in a folder called “InAppPurchaseToggleCode”, this is to simply multi platform (ARM, x86, x64) until NuGet is able to provide dll versions for different platforms.

Single In App Offer

Assuming you had set up an in app offer in the developer dashboard for your app called “AwesomeFeature1” you would create the following class:

internal class AwesomeFeature1 : InAppPurchaseToggle.SinglePurchaseToggleBase {}

There’s no need to implement anything else. Note: the name of the class exactly matches the name of the offer that was created in the developer dashboard.

More...

SHARE:

App Idea Evaluator for Windows 8

Most of the time I have too many ideas for apps and which ones to build first, the App Idea Evaluator lets you create a list of ideas and rank them against a number of criteria. It also provides a few overview graphs to sum up the overall picture of your ideas.

http://bit.ly/appideaevaluator

SHARE:

Creating an “Add New” Item Template in a Windows 8 App ListView

A common UI pattern is to have a list of things on screen and at the end of the list have a plus icon (or something) that triggers your “add new item” code.

For example, in the Weather app:

cdt_weatherapp

For example, say we want to display a list of friends in a XAML ListView and at the bottom of the list have a “+” that adds a new friend.

public class Friend
{
    public string Name { get; set; }
}

The first step is to enable us to differentiate between what is an actual friend in the list and what is the “add new placeholder” item.

More...

SHARE:

Quick-Start Guide To Using xUnit To Test Your Windows 8 WinRT Store app

Until xUnit officially supports* Windows store apps you can get xUnit working with your WinRT app by doing the following:

In Visual Studio 2012, go to Tools menu, Extensions and Updates; search for and install “xUnit.net runner for Visual Studio 2012”.

xUnitRunner

In Visual Studio 2012, go to Tools menu, Extensions and Updates; search for and install “xUnit Test Library Template”.

xUnitTemplate

You may have to restart Visual Studio…

More...

SHARE:

The Complete Beginners Guide to using SQLite SQL database in a Windows 8 App

[Writing this on the train home so may be a bit rushed – sorry :) ]

Install the Bits

  1. In Visual Studio 2012, go to Tools menu, Extensions and updates.
  2. Search for “SQLite for Windows Runtime” – install it.
  3. In your Windows Store app, install the NuGet package called “sqlite-net” – these are the LINQy wrappers over SQLite.

Use SQLite

Create an “entity” that you want to store in a table, e.g. Customer.

Create some plain properties, choose one to be your primary key, e.g.

[SQLite.PrimaryKey, SQLite.AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }

 

Create a constant to be the filename of the SQLite db on disk:

private const string dbFileName = "data.dat";

More...

SHARE:

The Enterprise Re-Imagined with Windows 8

If your company is currently in the process of upgrading to Windows 8, do they see it as a simple OS upgrade to keep up to date; or, do they see it as an enabler to re-imagine how the business operates?

Windows 8 offers the potential to streamline business processes, lower costs, and offer additional customer service opportunities

With an internal app store, domain-joined tablet PCs and innovative leadership, Windows 8 can offer the potential to streamline business processes, lower costs, and offer additional customer service opportunities.

Multiple Internal Apps

Refactoring Legacy Applications

Most companies without excellent software development practices and management end up with big, kitchen-sink. costly-to-maintain software systems.

Internal-facing corporate Windows 8 apps offer a solution to this problem.

More...

SHARE:

Getting Ready to Build Your First Windows 8 App

This article outlines an approach to getting started building you first Windows 8 app, but rather than focus on the technology aspects it focus on the pre-coding activities.

The Idea

So you have a few ideas for your first app, but how do you decide which one to build? It depends on what you want to get out of it. If you want to use your first app as a learning experience or to get some app building experience on your CV then you may not be concerned with monetisation.

Monetising you App

If you are attempting app building as a means of income generation then you’ll want to consider what monetisation options Windows 8 gives you:

  1. Paid app
  2. Free app with adverts
  3. In-app purchases*

*You can also use in-app purchases with paid or free apps and with or without ads.

Regardless of app type, you should offer a version of the app without ads for those people who really dislike them.

The Appeal Spectrum

One way of deciding which app idea to build is to think of its potential appeal. If you imagine this appeal as a spectrum from widest appeal (think Facebook, Twitter, etc.) to those with limited appeal (specialist niche apps, etc.).

On top of this spectrum we can add some potential income factors: will millions of people pay hundreds of dollars for the app, or will millions of people pay a dollar for the app?

More...

SHARE:

What I Learned Building My First 4 Windows 8 Apps

This is a bit of a brain-dump, in no particular order, of things I learned building my first 4 Windows 8 (C# XAML) apps:

- Countdown To

- Big Screen Countdown

- BizBuzBingo

- Code Retreat Countdown

Adding Microsoft Ads to your App

  1. Sign up here: PubCenter
  2. Create a Windows 8 Ad Unit (note the different ad sizes)
  3. Install the Advertising SDK
  4. Add a reference to the ad assembly
  5. Ads the AdControl to your XAML, set the application ID and Ad Unit Id properties to those specified in you ad unit in PubCenter (for testing ads before publication see this DZone article)
  6. Ensure your ad unit control has it’s width and height set to that of your ad unit
  7. Ensure that the app capabilities have Internet enabled (otherwise you wont see any ads show up).

Certification Failure when your App has internet capability

If you app is capable of connecting to the Internet, you must have a Privacy Statement (or link to web based privacy policy) in your app – usually in a custom settings fly-out (from the Settings Charm). You must also have a web-based copy of this hosted somewhere on the Internet as you’ll need to provide the URL to it when you submit your app to the store. If your app has no Internet connectivity enabled, you don’t have to do this.

More...

SHARE: