ReBuildAll Blog
Thoughts (mostly) on .NET development

Unit testing database code   (Tips & Tricks)   
You probably use some kind of ORM product when creating solutions. The ORM manages the communications with the database. On top of the ORM code you maybe layer other code - repositories, domain services or something else. Or maybe you use the ORM directly from your controller (if you are using MVC patterns).

In this article I will demonstrate how to test this database code by using "unit tests".

Thanks goes to Offbeat Solutions for the idea (NHibernate + SQlite)!

Scenario
My demo consists of the following scenario and technologies. From the bottom up: data layer is SQL Server. I will use Entity Framework Code First to access the database. The Entity Framework code is called from a repository layer which groups together logical operations. The controllers of the application use the repositories to access the data.

I will reference my example code throughout the article. Be sure to take a look on GitHub!

The example uses Entity Framework and Visual Studio Unit Tests (MSunit) but it should not be difficult to apply to other ORMs and tests suits as well.

Why unit tests should not hit the database?
Unit tests should run independently from one another and from other resources, especially external dependencies. If we allow the unit test to go to the real database (even a development database) we hit some big problems. How can we guarantee the data is intact, is always the same? If a test modifies the database, does it affect another test? How can I run the tests on the build server where there are no databases available?

You could of course install a database on the build server and setup some SQL scripts to delete all data prior to tests, etc. But I would argue you are still setting yourself up to trouble, not to mention that now in order for the tests to run those SQL scripts need to be maintained, something that we developers are pretty bad at :)

If you do not want to go to the database ...
If your unit tests cannot go to the database, then the repository layer is the one you will have to cut off. In my example code, you will find the IProductRepository interface, which describes the interface for the repository. The ProductRepository implements this interface, and uses the Entity Framework to retrieve the needed information.

If I wanted to test my code without accessing the database, I could write another repository implementation called ProductMemoryRepository that implements the interface, but operates in memory. I would put this implementation in the unit test dll and then inject that into the code (into my ProductController for example).

The problem with this approach is that the code in my actual ProductRepository is not tested. There might be LINQ expressions and filters there that are now outside the scope of my test.

Enter SQL Server Compact Edition
How can we test our repository code without going to the actual database? SQL Server Compact Edition is an in-process database server that you can include in your application. You include a DLL, and voila, you have SQL Server inside your application (well, more or less). There is even an Entity Framework binding available. Entity Framework and SQL CE is available through NuGet.

The only thing is, SQL CE requires a file to store the data in. But it can be any file (even a temp file) that can be destroyed as soon as the last connection is closed to the database.

Can we use this in unit tests? Absolutely.

Because Entity Framework works with SQL CE, we do not need to modify our entity framework code at all.

So before our test runs, let's create a new database:

        [TestInitialize]
        public void Initialize ()
        {
            currentFile = Path.GetTempFileName();
            string connectionString = string.Format(
                "Data Source={0};Persist Security Info=False", currentFile);

            var conn = DbProviderFactories.GetFactory("System.Data.SqlServerCe.4.0").CreateConnection();
            conn.ConnectionString = connectionString;
            conn.Open();

            entities = new Entities(conn);
            entities.Database.CreateIfNotExists();

            Seed();
        }


What happens here?

First we generate a temporal filename, and construct a connection string using that. We open a new connection using this connection string, and pass the connection to our entities class. We also make sure our database and tables exist. This last step guarantees that our test will always have a fresh copy of the database, and we do not need to maintain our tests to provide a fresh and clean database. This call will be called before every test is run, so every single test will have its own database to work with.

Our code first entities class which I cacled Entities needs a new constructor for this to work:

    public class Entities : DbContext
    {
        public Entities ()
        {
        }
        public Entities(DbConnection connection)
            : base(connection, true)
        {
        }


The default constructor is used normally in the code, and it finds the connection string from the config file. The second constructor receives the connection through parameters. This is how the connection is given to the entities class.

The test initialization method also calls a seed method at the end. This is how some initial data that is required by the test can be added to the database.

        protected virtual void Seed()
        { }


At the end of the test we need to destroy the database.

        [TestCleanup]
        public void Teardown ()
        {
            entities.Dispose();
            entities = null;

            File.Delete(currentFile);
        }


All this code can go into a base class that the actual test classes will inherit, if they require database access. In my sample code this is called SqlCompactBasedTest. All test classes should inherit this that require their own database for testing.

Now we can create a simple test:

        [TestMethod]
        public void Test_AddProduct()
        {
            Product p = new Product() { Name = "Raspberry icecream", Price = 1.99m };
            Entities.Products.Add(p);
            Entities.SaveChanges();

            var cheapThings = Entities.Products.Where(product => product.Price < 10.0m);
            Assert.AreEqual(1, cheapThings.Count());
        }


Because we know exactly in the test what is in the database BEFORE the test, we can make assertions on the contents after we perform some operations. Please check the example code for more sample tests.

Here I used the Entities class directly, but of course I can also write tests that test other aspects of the code base, but in the end, somewhere deep down the call chain they use the database. In the sample code you can see such a test in the RepositoryTests test class in the test method ProductController_ShowProducts().

Example code
I implemented the concepts demonstrated here in an actual solution. The application is very small and not a real application in the sense that the main program does not do anything. The unit tests however do work and use the technique described above. The sample uses NuGet to pull in those dependencies.

The application has a very basic data model, with some persons, products and orders. It also has a database migration for Entity Framework, so you might create the data in an actual SQL Server database, but the sample program does not really access this. The unit tests use the technique described above and contain the helper class to set up the database.

You can find the code on GitHub

Moving ASP.NET Identity model into another assembly   (ASP.NET)   
Visual Studio 2013 and MVC 5 has arrived (as well as the "One ASP.NET"), with ASP.NET Identity in tow. The new identity feature allows user profile information to be part of the ASP.NET Identity model. In essence, the identity data structure can be merged with whatever data your application has, creating a seamless integration of identity data and application data.

The result? You do not need to have two data models / entity models for your application (and as such, two Entity Framework DbContext's).

Microsoft also provides a description of how this can be achieved, using Entity Framework migrations.

But what if you want your data model to live in another assembly, not the default web application? Reasons for such a thing might be a shared data access layer between different applications. You could have a Web application and another service that does background processing, both of which need access to your data.

The default ASP.NET MVC 5 project will have an IdentityModel.cs file in the Models folder. This contains the expandable identity model. But it is included in your Web application.

This is a description of how you move the identity model to another DLL.

Add a class library
The first step in moving your data access logic to a central assembly is adding a new class library project to your solution. This new class library will contain the data access layer, and you will reference it from other projects that need data access.

Go into NuGet package management, and add the Microsoft ASP.NET Identity EntityFramework package to the project. This will also pull in some dependencies.

Now you are all setup to actually move the identity model here.

Move over the identity model
Next, take your Models/IdentityModel.cs file from the Web application and move it into the new class library. (Move, and do not copy it. It should not be in the Web application after this step).

Change the namespace in the file to match that of your intended data access layer.

Optionally, you might want to create a separate file for the data context class. This would be a good time to do that.

Add references and usings
Last step, go back to your Web project and add a reference for the data access library.

Open AccountController to add a new using statement for your new data access namespace.

Start working on the data access layer
And now you are done. You can now add your entity classes and add IDbSet properties to the data context class. Build your data access layer. You will have only one data context class, that has both your application data and your identity data together.

WoDalmanac   (Apps)   
So I had this idea that I will start publishing some of my so far private work as open source. I do not know how much time I will have supporting this idea, but it seems like something good to do. I decided to start a new blog dedicated to this effort (which does not mean I want to abandon this one).

As a first application I published WoDalmanac. It is a tool I did for our role playing game sessions. Very useful for Vampires and Werewolves :-)

Read more about this tool here: WoDalmanac

From there you can visit the Bitbucket repository or download in binary format. It is written in C# and runs as a Windows application.

WSDLMerge v1.2   (ASP.NET)   
WSDLMerge updated with small bugfix. Available from the project's google code page as usual. Both source and binary.

WSDLMerge updated   (Web services)   
I wrote about a tool I made in this blog before (see the original article here). The tool called WSDLMerge can merge WSDL documents and XSD documents that it references into a single file.

I just updated this tool. The updated source code and now also precompiled binary version is available from the project's site.

I ran into some problems with some WSDL files, which made me update the tool. Some people also wanted a binary version instead of just source, so that is now also uploaded.

I had a WSDL file that referenced different XSD files, but with the same targetNamespace. This made WSDLMerge ignore the second import.

Also, the include statements are now getting parsed as part of the XSD files. The included schema is inlined into the schema that invokes the include.

Extending MVC validation with new rules   (MVC)   
Did you ever want to extend MVC validation with new rules? For example in my work I need to validate fields that contain Finnish social security numbers, business identification numbers or IBAN bank account numbers. These have a well defined format. They also have check digits/numbers that can be used to verify if the number is actually valid.

While I could use simply regular expressions to verify the format itself, it is not possible to validate the check digits / numbers without actually coding them.

If you have used data annotations to create your ASP.NET MVC models, you know that it is very easy to add different kinds of validation rules to your data model. ASP.NET MVC will take care of generating all the needed client side validation logic for you (which uses jQuery Validation) and also makes sure the data is validated on the server side as well.

In this article I will show how to extend this mechanism and provide easy to use client and server side custom validation using the same mechanics. I will use MVC 4 in this article, but the core validation works with MVC 3 as well (some examples use bundles, which were not in MVC 3, but the actual validation logic will work with MVC 3).

Javascript validation
Let us start by creating a validation method for IBAN account numbers in Javascript. We want to extend the jQuery Validation framework that comes with ASP.NET MVC project template. The following code directly adds a new validation method to jQuery Validation. First the code, then the explanation:
$.validator.addMethod("iban", function (value, element) {
    var conversion = {
        "A": 10, "B": 11, "C": 12, "D": 13, "E": 14, "F": 15, "G": 16,
        "H": 17, "I": 18, "J": 19, "K": 20, "L": 21, "M": 22, "N": 23,
        'O': 24, "P": 25, "Q": 26, "R": 27, "S": 28, "T": 29, 'U': 30,
        "V": 31, "W": 32, "X": 33, "Y": 34, "Z": 35
    };
    var numbers = "0123456789";

    var isValidIBAN = false;
    var ibanregex = /^([A-Z]{2}\d{2})\s?([A-Z0-9]{4}\s?)*([A-Z0-9]{1,4})$/;

    if (ibanregex.test(value)) {
        var iban = value.replace(/\s+/g, "").toUpperCase();
        iban = iban.substr(4) + iban.substr(0, 4);
        var convertediban = "";
        for (var i = 0; i < iban.length; ++i) {
            if (numbers.indexOf(iban.charAt(i), 0) == -1) {
                convertediban += conversion[iban.charAt(i)];
            }
            else {
                convertediban += iban.charAt(i);
            }
        }
        var reminder = 0;
        while (convertediban.length > 0) {
            var p = convertediban.length > 7 ? 7 : convertediban.length;
            reminder = parseInt(reminder.toString() + convertediban.substr(0, p), 10) % 97;
            convertediban = convertediban.substr(p);
        }

        if (reminder == 1) {
            isValidIBAN = true;
        }
    }

    return this.optional(element) || isValidIBAN;
}, "Check your IBAN number!");

$.validator.unobtrusive.adapters.addBool("iban");

The addMethod method will add our validation logic to jQuery Validate. This new function will receive the value to be validated. The actual validation logic might not be the nicest Javascript code, but what it does is check the value if it is indeed a IBAN number. I included a regular expression that does the format checking as well, so I do not need to add that separately.

After the jQuery Validate method is added, we also register the iban validation method with the jQuery Unobtrusive Validation framework. The addBool method adds a new validation that returns true/false based on the result.

Ideally you would put this code into your own Javascript file (for example, customvalidation.js). You need to include this AFTER jQuery, jQuery Validation and jQuery Unobtrusive Validation .js files have been included in your code. In a MVC view, you could add it as follows:
@section scripts
{
    @Scripts.Render("~/bundles/jqueryval")
    <script src='@Url.Content("~/Scripts/customvalidation.js")' />
}

And voila, client side IBAN account validation is now available to your HTML code. Add the data-val-iban attribute to the element where you want to test it. The following ASP.NET MVC sample demonstrates how to create a simple form with one field, that has iban validation enabled on the client side:
@using(Html.BeginForm())
{
    <div>
        <input type="text" name="ibanaccount" id="ibanaccount"
            data-val="true" data-val-iban="Check your IBAN number!" 
            data-val-required="Required"  />
        @Html.ValidationMessage("ibanaccount")
    </div>

    <div>
        <input type="submit" value="Submit" />
    </div>
}

I created the input field manually by typing HTML code and adding all the validation attributes. I exploited MVC's ValidationMessage() method to generate the needed span to display a error message in case validation fails.

You can use the following sample IBAN number from Wikipedia to test: GB29 NWBK 6016 1331 9268 19. Or just enter your own IBAN number :) The validation does not even require the spaces, so you can freely omit those if you like.

Our goal is however, that you would not need to write the attributes manually. Instead we want this to integrate with Data Annotations attributes.

Server side validation
In order to create a new server side validation we will derive a class from ValidationAttribute. To tell MVC that we support client side validation the class will also implement IClientValidatable.

The attribute will contain both the server side logic and the code needed to use the Javascript validation we created above.

Let's create the skeleton of the class:
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
    public sealed class IBANAttribute : ValidationAttribute, IClientValidatable
    {
    }

Lets start with the client side validation first. The IClientValidatable interface defines a single member method that returns an enumerable collection of client side rules. We will use yield return to return a single rule:
        public IEnumerable<ModelClientValidationRule> 
                  GetClientValidationRules(ModelMetadata metadata, 
                             ControllerContext context)
        {
            yield return new ModelClientValidationRule()
            {
                ErrorMessage = "Check IBAN account number!",
                ValidationType = "iban"
            };
        }

The rule simply states what error message we would want and what is the validation type. The rule will generate a data-val-iban attribute similar to what we had in our HTML before on the client side.

Finally, lets create the server side validation method.
        public override bool IsValid(object value)
        {
            if (value == null) return true;

            Dictionary<char,int> conversion = new Dictionary<char,int>();
            conversion.Add('A', 10);
            conversion.Add('B', 11);
            conversion.Add('C', 12);
            conversion.Add('D', 13);
            conversion.Add('E', 14);
            conversion.Add('F', 15);
            conversion.Add('G', 16);
            conversion.Add('H', 17);
            conversion.Add('I', 18 );
            conversion.Add('J', 19);
            conversion.Add('K', 20);
            conversion.Add('L', 21);
            conversion.Add('M', 22);
            conversion.Add('N', 23);
            conversion.Add('O', 24);
            conversion.Add('P', 25);
            conversion.Add('Q', 26);
            conversion.Add('R', 27);
            conversion.Add('S', 28 );
            conversion.Add('T', 29);
            conversion.Add('U', 30);
            conversion.Add('V', 31);
            conversion.Add('W', 32);
            conversion.Add('X', 33);
            conversion.Add('Y', 34);
            conversion.Add('Z', 35);

            bool isValidIBAN = false;
            Regex ibanregex = new Regex(@"^([A-Z]{2}\d{2})\s?([A-Z0-9]{4}\s?)*([A-Z0-9]{1,4})$");

            if (ibanregex.IsMatch(value.ToString())) {
                var iban = value.ToString().Replace(" ", "").ToUpper();
                iban = iban.Substring(4) + iban.Substring(0, 4);
                var convertediban = "";
                for (var j = 0; j < iban.Length; ++j) {
                    if ( char.IsDigit ( iban[j] ) == false ) {
                        convertediban += conversion[iban[j]];
                    }
                    else {
                        convertediban += iban[j];
                    }
                }
                var reminder = 0;
                while (convertediban.Length > 0) {
                    var p = convertediban.Length > 7 ? 7 : convertediban.Length;
                    reminder = int.Parse(reminder.ToString() + convertediban.Substring(0, p)) % 97;
                    convertediban = convertediban.Substring(p);
                }

                if (reminder == 1) {
                    isValidIBAN = true;
                }
            }

            return isValidIBAN;
        }

Notice how similar the code is to the Javascript version (thanks to the var keyword, for example). Except maybe the dictionary filling code, which is longer to do in C#. The method check the format using the same regex, and then validates the argument. It returns a boolean value based on the result.

This is all we needed to have both client and server side validation added for IBAN account numbers. Similar methods can be used to add validation to just about any kind of custom validation logic. As a last step, we will test how this works.

Putting our new attribute onto a model
Lets create a new model to test our validation logic.
    public class SimpleTestModel
    {
        [Required]
        [MaxLength(50)]
        public string Name { get; set; }

        [IBAN]
        [Required]
        public string AccountNumber { get; set; }
    }

And create a new action method that will use this model and also accept it back on POST requests.
        [HttpGet]
        public ActionResult TestIban()
        {
            SimpleTestModel model = new SimpleTestModel();
            return View(model);
        }

        [HttpPost]
        public ActionResult TestIban(SimpleTestModel model)
        {
            if (ModelState.IsValid)
            {
                // save
                // ..

                return RedirectToAction("Index");
            }
            else
            {
                return View(model);
            }
        }

And finally add a view. I will only show you the part that renders the account number field. You can easily generate the view based on the model class using MVC's scaffolding feature (use the Create or Edit template).
        <div class="editor-label">
            @Html.LabelFor(model => model.AccountNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.AccountNumber)
            @Html.ValidationMessageFor(model => model.AccountNumber)
        </div>

As you can see, it does not differ from any other field you would have used previously in MVC. And now when you try this, you will see client side validation working. If you want to test server side validation you need to either disable the client side validation (just remove the interface from the attribute class) or use a tool like Fiddler to manipulate the request before it gets to the server.

Summary
Adding client and server side validation to ASP.NET MVC is an easy task if you follow the steps outlined here. You can add as many different kinds of validations as you need.

Blog engine update, hopefully content follows as well   (Bl0g)   
I updated my blog engine once again, migrating it from MVC 2 to MVC 4. It was a real pain doing the migration, especially since I used ASPX View Engine back in the good old days :) Nevertheless, it was a good opportunity to learn and practice.

I did not change the view engine that was used, but updated other parts. Now using MVC 4, and newer script libraries. I also updated some components, like the source code highliter and of course the theme. The page is now (hopefully) more mobile friendly as well. Tablets, mobile phones should scale as needed.

Hopefully I will have time this year to create some new articles. I have been playing a lot around Javascript, and there are some real headaches that I would want to write about.

Tomorrow I will be talking about Typescript at TechDays 2013 Finland. The talk is in Finnish, but it required some work on my part - again potential blog articles. ;-)

I will also need to respond to some comments, because they seem to be coming still to older articles.

Ludum Dare #25   (CubeHead)   
Long time no posts here. Will have to try and revive this blog. Maybe after I finished my Ludum Dare game :) The game is written in HTML5 and Javascript. As per LD rules, source code will be available after it has been submitted.

You can read more about my entry here:
More info here

Visit the Ludum Dare pages if you are interested in playing or want to grab the source.
Villanus Haerfest

As mentioned above, the game uses HTML5 and Javascript. I recommend Chrome, but IE9+ or FF should work also.

UI Kompositio   (ASP.NET)   
This article is only available in Finnish. It relates to my talk at Tech Days Finland 2012.

8.3.2012 pidetyssä Tech Days 2012 Finland tapahtumassa olin puhumassa UI Kompositio aiheesta, miten rakennetaan käyttöliittymää käyttäen Javascriptiä pienistä paloista. Tästä löydät esityksen PowerPoint sekä PDF muodossa, ja demo sovelluksen.

Kun lataat demo sovelluksen, muista lukea asennus.txt tiedoston mikä kertoo miten tietokannat ja ympäristö rakennetaan.

UI Komposition esitys (.pdf)

UI Komposition esitys (.pptx)

UI Komposition demo (.zip)

Windows 8 Consumer Preview   (Windows)   
The Consumer Preview version of Windows 8 (fancy name for public beta) became available yesterday. I installed it into a virtual machine. This article summarizes my first impressions. I will updating this as I explore more features of Windows 8. My initial very negative opinion on the UI is now not so negative, resulting from the exploration and learning I did. But this also means that there is a learning curve, without it, with just intuition alone, you will not be able to "enjoy" the new UI, in my opinion.

Overall, apart from some usability complaints (which are explored in the rest of this article), I could probably imagine working in Windows 8. The UI still feels strange and a little bit clumsy. Probably this is because I do not think the Metro style UI and applications are in harmony with the desktop paradigm. Anyhow, there are improvements compared to the developer preview, but I still find it is not as smooth of a user experience as Windows 7 is today.

Update: If you are a heavy keyboard user, here is a list of keyboard shortcuts that come in very handy with Windows 8. Very useful! Windows 8 keyboard shortcuts.

If Windows 8 would be released today, I do not think I would want to upgrade. The mix of Metro-style and regular applications is not as smooth as I would want it to be. Frankly, I do not think this new Metro-style thing belongs to the desktop, and I for one do not see as an improvement.


Features of Windows 8

I will not try to introduce the features of Windows 8, because there are tons of articles with pictures. Please refer to Engadget for one such article. And I really like the punch line for that article:

We really liked Windows 7 when it launched. It felt like a big step forward in the short time that had passed since Vista. Now, as we creep closer to a likely release near the end of this year, we can't shake a sense of doubt. Windows 8 still feels like two very different operating systems trying to be one. The potential is hugely alluring -- a single OS to rule both the tablet and the desktop -- and with each subsequent version we keep hoping this will be the one that ties it all together. Sadly, as of the Consumer Preview, we're still seeing a lot of loose threads.

As it stands, Windows 8 is a considerably better tablet operating system than any previous version has managed to be. However, it's still a clumsier desktop OS than Windows 7. That's a problem Microsoft must fix before release.
(from Engadget)


The Metro experience

Anyone reading about or trying out Windows 8 will probably know what Metro-style applications are. They can be started from the new Start screen, they run full screen, and cannot be removed from being full screen (other than using snapping). Running applications full screen seems natural for certain solutions. For web browsers, it is a natural way to operate. For some other applications, it just isn't.

Sidenote: Why kill windows in Windows? If everything is full screen, there are no windows anymore. Hmm? :)


Full screen

For some applications, running them full screen seems outright ridiculous. For example, take the default calendar application on a 24" screen. On a 10" tablet those might look nice, but it just does not work on big screens. Messaging application - I never-ever run chat/messenger in full screen. I like having it floating around above/near other windows. I can do work in my main window and follow the chat at the same time.

I have created some tools and small programs that run as quite small Windows. There would be no sense in making an application full screen, that requires 2 or 3 textboxes for input. I simply cannot imagine how such a tool could be reimagined into being a Metro-style application. Of course if I wanted to create a smartphone or tablet version, sure, no problem. But putting 2 textboxes and a small image on a 24" screen? Or 30" for that matter. I just do not think this is a universally good idea. (I am about to explore Windows 8 application development further, so I might revise this paragraph in the future)

You cannot switch Metro-style apps to run in a Window. Going back to the calendar application: I usually have a webpage, email, chat or something else opened to which the calendar would relate. Having windows side by side makes it much easier than having to alt-tab all the time. I have a high resolution 24" monitor at home, and two large displays side-by-side at work. I have them not because I enjoy looking at full screen things. I have big screen real-estate to actually use it for MULTIPLE WINDOWS at the same time. Forcing new apps (Metro-style) to run full-screen, it is a waste of screen real estate.

Snapping applications partially solves this problem. You can use Windows+. and Windows+Shift+. keys to snap application windows. You can even snap a Metro style app (the calendar) and then the remaining space can be used by the desktop. And mind you, snapping is not something you would figure out for yourself - I certainly didn't :)

Normally I can remove apps from full screen, and very easily put them side by side. Just press "Windows+left" and "Windows+right" and you can arrange your apps very fast in Windows 7. Or use the mouse and drag the title bar to the left side, top side or right side. Very very easy and very very fast. I was actually very impressed, how much thought went into the usability of Windows 7. With Windows 8, I do not find that Metro-style apps improved this in any way, even considering snapping.

I really do not care how much Microsoft tries to justify this new user interface. When Windows 7 came out, you could feel the improvement. With Windows 8, you can feel the setback in user experience.

When you look at the changes from the tablet perspective, it of course makes all sense. I can understand ALL of these choices and behaviors when using a mobile phone or a tablet. There I would even expect everything to work like Metro does. And I don't doubt that Windows 8 tablets will be very nice to use. BUT the desktop is different, and using the same paradigm for the desktop will hinder performance and efficiency.


Messenger

I seem to be signed in to messenger as soon as I sign in to Windows (because I used a Live account to sign in). Where do I began to list all my problems with this solution. From not being in control of when I am online, invisible and offline (signing in to Windows DOES NOT MEAN I am available for chatting) to my chatting account being different from the one I use to sign in (I have 3 live accounts) there are so many things wrong with this solution. I finally found the "Accounts" setting for the Messaging application, but I cannot add more live accounts, nor can I change the one I signed in with.

I installed the currently available version of Live Messenger from the Web, and then I can just use it like I did before. So disable Messaging live tile, install Live Essentials, and good go go :)


Task Manager

You have to love the new Task Manager. It really works well for the power user, shows lots of details and lets you dig deep into how the system is working, what is running. It shows per application network usage, lets you manage the system services. Wonderful improvement.


Application switching

I can now switch to the desktop right from the Start screen. No tricks needed (like last time). By default there is a tile in the start screen that switches to the desktop. You can also switch there if you have multiple monitors by clicking on the secondary display. Because the start screen is only visible on the primary display.

And yes, Alt-Tab now switches between ALL open applications, both Metro-style and traditional applications. Also very good.

And you can move your Start screen and full screen metro apps to another display as well.


Corner menus

When you move your mouse to one of the corners, something will happen. Upper left corner allows you to switch application, and even to list the metro-style apps for easy switching. Lower left corner will allow you to go to the start screen or the regular desktop. Lower and upper right corner will show the charms bar.

They are good until you have multiple monitors connected. When you have multiple monitors, the secondary monitor will be either left or right side of the first. These corner shortcuts will thus fall onto the BORDER between two monitors. So it actually becomes an aiming excercise with your mouse to aim for the primary display's corner that now lies BETWEEN two monitors. Good luck with that! :)


Start menu, Searching

Windows 8 removes the start menu. Thinking about it, I hardly ever went in there. Usually I opened it with the Windows key, and searched for what I want. So it is not a big loss for me.

Windows 8 changes searching in a way, that the default search does not always find what I am looking for. You know the sound dialog, where you can pick your playback and recording devices? I usually typed sound into the Start menu to find it. It was the first or second pick.

If you do this in Windows 8, it will not find it. Because this dialog is categorized as a setting, not as an application. You see, there are three searches now: Applications, Settings and Files. You have to know in advance, what you are searching for, because only those results are displayed. You can change that, but it requires extra clicks or keys. Anyhow, remembering the three quick keys for these makes search usable (Applications: Win+q, Settings: Win+w, Files: Win+f)


Hard to find options

Every wanted to shut down Windows 8 - did you succeed without using Bing or Google to look up how to do it? Intuitiveness is very important in user interfaces. It is something that should be very very important in every user interface. People are lazy reading manuals, and they will get frustrated when something does not work they way they expect it. Shutting down or restarting Windows 8 is one of these things.

Again, my analogy - in Windows 7 many options feel very natural, and you really do not need much learning to use it. You might say I am accustomed to the way Windows works, but I also use Mac OS. I did not have trouble finding things there either, and I certainly did not have to use Google to figure out how to turn off the computer.


Task bar in desktop mode

A small complaint, but the task bar is now visible on both monitors in multi-monitor setup. Hopefully there is an option in there somewhere, that can make it appear only on the primary monitor. Not a big deal though.


Further notes

Just some random observations.

My mice have back and forward buttons (one is a Microsoft mouse, the other is a Razer). They usually work even without any drivers. However, Windows 8 does not respect these buttons, for example, in the Store, when there is clearly a back button on the user interface. Pressing mouse buttons does not move you anywhere.


Summary

Compared to the Developer Preview, there are some advancements in usability. The start menu gone, but you can launch your applications and with time, find your way around Windows again. I just do not understand why Microsoft fails to see how the Metro-style operation is not something that seamlessly works with the desktop.

I will not say that you could not renew the way Windows works. By all means, there are probably always improvements to make. But a mouse and a touchscreen with a finger will require different ways to operate things, and I simply do not believe that you can get away by trying to use the same solution to both scenarios.