I am working on CI for my team,  new projects are using .net framework 4.5, our server 2008 also has framework4.5 installed, but My TFS2012 still got Error like this:
The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v4.0'. This application requires 'v4.5'

There are two solutions I tried can fix this issue.
both need use a textpad edit the project file:
Add one of below before <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>:

<IgnoreDeployManagedRuntimeVersion>True</IgnoreDeployManagedRuntimeVersion>
or
<DeployManagedRuntimeVersion>v4.0</DeployManagedRuntimeVersion>

ref
http://stackoverflow.com/questions/19834307/msdeploy-cannot-deploy-net-v4-5-package-to-v4-0-application-pool


 
Categories: Agile | Asp.net | Visual studio 10/up

1. Function Review: Satisfy requirement
2. Security Review: SQL injection prevention and valid user input
3. Test Review: Accept Test and Unit Test coverage
4. Code quality Review:
a. Readable:  Name Convention, length of function
b. Solid principle
1) Single Responsibility, DRY (don't repeat yourself), make code reusable
2) Dependence,  check New instance code, check if interface defined. (testable)
3) Open Close, check "switch case", "if else" "Enum" code

c. other code refactor check
1) "out" "ref"
2) null check
d. Good performance check
e. Exception handle
f. Logging
g. Try best to remove the project build warning.


some useful ref:
http://www.codeproject.com/Articles/593751/Code-Review-Checklist-and-Guidelines-for-Csharp-De
http://www.amazedsaint.com/2010/11/top-6-coding-standards-guideline.html
http://www.codeproject.com/Articles/524235/Codeplusreviewplusguidelines


 
Categories: Agile | C# | Interview Question

There is full lists :link

First we take look the Tools related with Visual Studio:

MSTest, the unit test framework in Visual Studio

Coded UI Test

Microsoft Fakes,

Microfoft Test Manager

Visual Studio Memory Profiler

Visual Studio Performance profiler

Visual Studio Load Test, part of VS Ultimate(Testing Performance and Stress Using Visual Studio Web Performance and Load Tests)

TestDriven.Net, unit test running for Visual Studio


Other Test tools I have used:

nUnit,

JetBrains ReSharper UnitTest , 

moq,

SpecFlow




 
Categories: Agile | UnitTest | Visual studio 10/up

Reference:

http://www.codeproject.com/Articles/105497/Automated-UI-tests-with-Watin-in-ASP-NET-MVC

http://blog.willbeattie.net/2011/06/getting-started-with-specflow-watin.html 

My Spectflow feature file

My Step files:
#region Fill fields in form and Submit UserAccountInfo Request

    [Given(@"I on the UserAccountInfo metadata UI test page")]
    public void GivenIOnTheUserAccountInfoMetadataUITestPage()
    {
        CurrentBrowser.GoTo(@"http://localhost:45166/TestWidgetAction?widgetName=BusinessCenterAdminWidgetUser&actionName=UserAccountInfo&returnFormat=HTML");
        CurrentBrowser.WaitForComplete();
    }

    [Given(@"I have entered All fields for UserAccountInfo Metedat UI")]
    public void GivenIHaveEnteredAllFieldsForUserAccountInfoMetedatUI()
    {

        CurrentBrowser.TextField(Find.ById("SessionID")).TypeText(RequestData.SessionID);
        CurrentBrowser.TextField(Find.ById("AccountNumber")).TypeText(RequestData.AccountNumber);
        CurrentBrowser.TextField(Find.ById("AccountContextID")).TypeText(RequestData.AccountContextID);
        CurrentBrowser.TextField(Find.ById("UserID")).TypeText(RequestData.UserID);
        CurrentBrowser.TextField(Find.ById("ConsumerID")).TypeText(RequestData.ConsumerID);
        CurrentBrowser.TextField(Find.ById("TransactionID")).TypeText(RequestData.TransactionID.ToString());
        CurrentBrowser.TextField(Find.ById("OutputType")).TypeText(RequestData.OutputType);
    }

    [When(@"I click submit button for UserAccountInfo Metedat UI")]
    public void WhenIClickSubmitButtonForUserAccountInfoMetedatUI()
    {
        CurrentBrowser.InjectAjaxMonitor();
        CurrentBrowser.Button(Find.ById("btnSubmit")).ClickNoWait();
        
    }

    [Then(@"The Request Url woll displayed in Request section of UserAccountInfo Metedat UI")]
    public void ThenTheRequestUrlWollDisplayedInRequestSectionOfUserAccountInfoMetedatUI()
    {
        CurrentBrowser.WaitForComplete();
        CurrentBrowser.WaitForAjaxRequest();
      var divRequest= CurrentBrowser.Div(Find.ById("divRequest"));
      Assert.IsTrue(((WatiN.Core.Element)(divRequest)).OuterText.Contains("AccountNumber="+RequestData.AccountNumber));//
    }

    [Then(@"The AccountInfo will be loaded in Response Section of UserAccountInfo Metedat UI")]
    public void ThenTheAccountInfoWillBeLoadedInResponseSectionOfUserAccountInfoMetedatUI()
    {
        var divResponse = CurrentBrowser.Div(Find.ById("divOutput"));
        Assert.IsTrue(divResponse.OuterText.Contains(RequestData.AccountNumber));

    }

    #endregion

 

WebBrowserHelper.cs
 [Binding]
    public  class WebBrowserHelper
    {
        public static Browser CurrentBrowser
        {
            get
            {
                if (!ScenarioContext.Current.ContainsKey("browser"))
                {
                    ScenarioContext.Current["browser"] = new IE();
                }
                return (Browser)ScenarioContext.Current["browser"];
            }
        }
        
        [AfterScenario]
        public static void Close()
        {
            if (ScenarioContext.Current.ContainsKey("browser"))
            {
                CurrentBrowser.Close();
            }
        }
    }

My Codes:

 BrowserExtension.cs (1.72 KB) WebBrowserHelper.cs (.85 KB) UserAdminStepHelper.cs (.75 KB) 
UserStoryForMetadataUI_LoadUserAccount.step.cs (5.74 KB) UserStoryForMetadataUI_LoadUserAccount.feature (1.25 KB)
 
Categories: Agile | C# | UnitTest

November 28, 2012
@ 10:59 PM
we are practice BDD by using specflow.

for a web application, when  the user story converted to specflow acceptance test,  it is all for broswer.

Acceptance test for controller is only for developer, not for non-tech business owner/analyst

So I want to use some tool to fill the gap.  After some Google search, I found Coded UI and WatiN could do this job.

Below two articles have a very good example how to do it.

specflow with CodedUI
https://github.com/techtalk/SpecFlow/wiki/Using-SpecFlow-with-CodedUI-API

Specflow with WatiN
blog.willbeattie.net/2011/06/getting-started-with-specflow-watin.html

Ok...which one is better?

 I need to try them and  compare them.

After try both of them,
I think Watin is much better for programmer and much easy to use.
my CodeUI code was broken soon after couple change, and it is very difficult to intigrate with the specflow.

see my other post for my code of specflow and watiN


 
Categories: Agile | C# | UnitTest

October 4, 2012
@ 01:15 AM

Notes of read book "clean code"  by Robert C. Martin

SRP: Single responsibility
DRY: Don't repeat yourself
OCP: open close principle

ex:
1. Switch break the SRP and OCP, should limit it in bottom and factory.
2. Try catch should keep it small ,and no code after try catch block
3. Use exception in stand of ErrorCode
4. Each function should has only one return...try avoid  break, continue, never use goto
5. one parameter is better than two parameters and better than three or more
6. Make sense Name and comments
7. First write the code as you think, then refactor to follow the principle
8. Don't return or pass null, empty list is much better
9. Put Error handle code out side the main logic

Something in the book I don't agree is for Name convention,
he don't like name interface with prefix 'I', and don't like put the type in classname such as AbstractProduct or Iproduct.

But I think that make our life easier when we code...if you need a interface,  With the help of Intelli come with VS or ReSharper ,you type 'I', it will jump out, if you need a Enum...type Enum..all Enum named start with Enum will list for you to choice.


 
Categories: Agile | C# | OODesign

My Vault Demo slids for in our company IT managers

Vault1.ppt (64 KB)
Why change? Why Vault?

VSS Does not offer cheap branching, so we hesitate to create branches. Also does not support ActionScript type filenames which forced us to use Subversion for FLEX development. Now we straddle using two Version Control systems.
Vault combines the best of VSS and Subversion and adds some enhancements of its own.
Surveyed about 20 Version Control systems. Several are cheaper(free), Several are more powerful (AccuRev, Team Concert). Vault has by far the lowest learning curve, has the essential features and is priced competitively.





 
Categories: Agile | ProjectManagement

I want to help our company to improve the application development life cycle. we likely will to chose Vault\Fortress as our Revision Control tool.
Below is my design of Application Development\QA\Build flow.
I will discuss with my boss base on this diagram.


 
Categories: Agile | ProjectManagement

After installed and tested Vault/Fortress. I think Vault has many features very useful for our team:

  1. Vault can import the data from database of VSS, and you can compare the update histories between VSS and Vault  
  2. Cheap branching, very fast and height efficiency. Atomic check in support. All the files you check in same time regard as one unit, if one of them commit failed then all the files will be rollback.
  3. You can shelve you unfinished change, and you can un-shelve it any where.
  4. Client User GUI is supper friendly and straightforward. Much easier to use than VSS or any other revision tools.

It has Integrated GUI with VS and Eclipse. In Visual Studio, only need 3 steps you can switch the opened solution from control of VSS to Vault.

 

  1. Supper easy to merge, it has similar functions like Beyond Compare, but integrated in its GUI. The tools of compare  branches and folders is also very useful when we do branch merge.
  2. It use SqlServer database as its backend, so it is easy to management.

It has Programming API, we can do some integration work ourselves if need.

7         Fortress is a Project Management and Bug tracking system. It integrated with VauLt, when you check in, you can easily broswer the project/bug items you are working on, and associate the “Bug_Id” with the checkin. All description in project/Bug item can be load to check in comments with out “Copy\paste”. You can force all check in must need a bug_Id.

8         Higher Security, you can set different privilege for projects/branches with different developers and groups.

 

There are more features I didn’t list.

More information available at http://www.sourcegear.com/products.html


 
Categories: Agile | ProjectManagement | VS 2005 | VS 2008

http://weblogs.asp.net/adilakhter/archive/2008/05/04/more-on-unit-testing-testcontext.aspx

What is TestContext?

TestContext is a abstract class of Microsoft.VisualStudio.TestTools.UnitTesting namespace that provides various information about the current test run. Purposes that has been served by TestContext Class -

1.  To store information and provide information to the unit tests during Unit Test Run.

2.  Provide a mechanism to measure performance of your code being tested by the Unit Test.

3.  In Testing the web service it stores the additional information, like server's URL.

4.  In Asp.Net unit tests, it get holds of the Page object.

5.  For Data Driven Unit Tests , it provides access to the data rows.



 
Categories: Agile | C# | UnitTest | VS 2008