quine in c#

A formatted version of the quine that I wrote in 2006

using System;
class MainApp
{
    public static void Main()
    {
        // quotation mark --> "
        char q = Convert.ToChar(34);

        // --> string b =
        string var = string.Concat(Convert.ToChar(115), Convert.ToChar(116), 
                Convert.ToChar(114), Convert.ToChar(105), Convert.ToChar(110), 
                Convert.ToChar(103), Convert.ToChar(32), Convert.ToChar(98), 
                Convert.ToChar(32), Convert.ToChar(61));

        // --> semicolon
        char s = ';';

        string a = "using System; class MainApp { public static void Main() { 
                char q = Convert.ToChar(34); string var = string.Concat(Convert.ToChar(115), 
                Convert.ToChar(116), Convert.ToChar(114), 
                Convert.ToChar(105), Convert.ToChar(110), 
                Convert.ToChar(103), Convert.ToChar(32), 
                Convert.ToChar(98), Convert.ToChar(32), 
                Convert.ToChar(61));   char s = ';'; string a = ";

        string b = "Console.WriteLine(a + q + a + q + s);Console.WriteLine( var + q + b + q + s + b); } }";


        Console.WriteLine(a + q + a + q + s); 
        Console.WriteLine(var + q + b + q + s + b);

    }
}

What is the difference between "StyleCop" vs. "VS2010 Code Analysis" vs. "FxCop"

I had this conversation the other day and started some investigation into this. Here is my quick recap from the below links

  • VS2010 Code analysis includes FxCop + more
  • VS2010 Code analysis and FxCop analyze assemblies
  • StyleCop is not part of the VS2010 Code analysis suite and checks C# coding style
  • StyleCop analyses source code

How to unit test a WCF service?

I am *very* keen on automating tests, so I was looking into unit testing a WCF service.

If I say "unit test", I mean a fast, in-memory, independent and automated test of a functional unit-of-work in the system.
Unit of work is at maximum one method (on my projects)
With thanks to Roy Osherove

Why should we unit test a WCF service?

Inconsistent code will bite you sooner or later - I reckon sooner ;-)

See this sample interface with some method signatures

void CalculateSalary(string environment, string emloyeeName, ...)

void GetListOfSubEmployees(string environment, string emloyeeName, ...)

void CalculateBonusPerYear(string environment, string emloyeeName, ...)

void GetOrderRegion(string environment, string emloyeeName, ...)

void UpdateEmployee(string environment, string emloyeeName, ...)

void MergePolicy(string emloyeeName, string environment, ...)

As you can see all methods have some common parameters (string environment, string emloyeeName).

"Hidden" shortcuts for testers in Visual Studio

Like most of us, I learned the following shortcuts from the menu
image
Figure: VS Run tests menu items with shortcuts

Ctrl+R,T Run tests in current context
Ctrl+R,A Run all tests in solution
Ctrl+R,Y Run all impacted tests

with their corresponding Debug Mode, by using <Ctrl> for the second keystroke. E.g. Ctrl+R,Ctrl+T Debug tests in current context

Today I discovered these additional shortcuts.
I discovered those by changing some shortcuts from using MSTest to TestDriven, as per suggestion from RBanks54 (which rocks BTW, both)

Latest Posts

Popular Posts