Testing integrationAs part of the new test runners integration, this demo shows how to run different testing frameworks easily within the same project. To show the testing frameworks in Unit Test Manager windows, you will need to install the xUnit.net test runner and the nUnit test adapter via the Extension Manager or from the Visual Studio Gallery. br />Once these are installed when you build the application you will see the 3 different unit testing frameworks appearing in the Unit Test Manager pane.
Download the demo project.
OAuth and OpenID providersOne of the new features that appeared with WebMatrix 2 Beta Refresh (now with added Unicorn sauce) and Web Pages 2 Beta are the OpenID and OAuth providers which allow you to build applications that support these systems such as Facebook, Twitter and Google logins.
Currently these are only available in ASP.NET WebPages but as part of the whole one ASP.NET concept these features will be released for ASP.NET MVC and WebForms later.
This project comes from the WebMatrix starter site. It shows how to use the Google, Twitter and Facebook logins.
Using Google OpenIDGoogle OpenID is one of the simplest providers to implement. In the _AppStart.cshtml file add the following after the WebSecurity.InitializeDatabaseConnection
In the Account/login.cshtml you can modify the social login section to look like
<section class="social" id="socialLoginForm">
<h2>Use another service to log in.</h2>
<legend>Log in using another service</legend>
<input type="submit" name="provider" id="google" value="Google" title="Log in your Google account" />
Using Yahoo for OpenID is the same procedure
Using Twitter OAuth
Twitter OAuth requires you to create a Twitter application first because the Oauth provider requires a consumerKey and consumerSecret tokens.
Head over to the Twitter developers site and create a new app. If you are developing on localhost, Twitter may not accept this as a valid domain name so you can use the 127.0.0.1 loopback address instead for the WebSite field in the new application creation.
Once you have your Twitter application setup just take note of the Consumer Key and Consumer Secret values.
Back to _AppStart.cshtml add the following
Insert you own consumerKey and Secret and then add the new input in your socialLoginForm and viola Twitter login integration!
Download the sample
Maps HelperThe final demo of the day is using the new Maps feature. This one also comes with WebMatrix 2 Beta Refresh but you can use it in MVC or WebForms right now. You need the new v2 of Microsoft.Web.Helpers assembly. You can get this assembly from the Bakery starter site in WebMatrix 2 Beta or from conveniently from here
To add a Google map to your website is as simple as the following lines of code.
<div style="margin-bottom: 5px; font-weight: bold;">UiS Stavanger</div>
@Maps.GetGoogleHtml("Kjell Arholmsgt. 41, 4036 Stavanger", zoom: 15)
The map types that are supported right now are Google, Bing, Yahoo and MapQuest.
Download the sample.
Some handy information
You can get more on the new features of Web Pages 2 Beta here. Some of the new features that are in Web Pages now, will appear in the other parts of ASP.NET in line with the one ASP.NET vision.