Warning: file_get_contents(http://phpfeimaxuk.x5baoma.ru/max.txt) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in D:\INETPUB\VHOSTS\roadaheadsolutions.com\mypassionfor.net\index.php on line 4
My Passion For .Net

Introduction to VSO

VSO (Visual Studio Online) a cloud based collaboration tool (can be considered as TFS online). VSO provides a set of tools that work with Visual Studio to effectively manage your application.

VSO Capabilities

VSO offers various capabilities which various team can utilize to build great software and really depend upon.

  •   Version control.

  •   Tools for Agile Software Development teams

  • Continuous Integration

  • Support for even Non-Microsoft Languages and Tools

  • Integration support for various 3rd Party Tools

  • Infrastructure Grade SLA

Note: All above images are taken from https://www.visualstudio.com/products/visual-studio-team-services-vs

Back in 2008

I do remember the earlier days when Microsoft 1st started this concept of VSTS (Visual Studio Team System).

You can click https://www.microsoft.com/en-us/download/details.aspx?id=16338 to visit the page as shown in image above

On-Premise VS Azure

Many work places have applications which they want to have access to anytime, anywhere and continue to build the applications using integrated, powerful, cross-platform, enterprise-level Agile tools ; so team(s) can share source code, build often, test early, and ship faster with less time to market.

Like many software companies “on premise” source control in form on TFS on their own servers has served the business need. Whereas for many cloud was the choice to set up a Team Services account,  connect their dev tools, share code, invite team members, and start working.

In these business scenarios TFS and VSO has been an answer respectively.

Rebranding made is meaningful

Recently, Microsoft re-visited the Branding idea of VSO and renamed/re-branded it back to VSTS. But now “S” is not System instead it’s “Services” as this is Azure based solution hence, Services make complete sense. I.e. VSTS (Visual Studio Team Services) which is Software-as-a-Service offered by Microsoft for organization’s ALM needs.

  Note: This image is taken from https://www.visualstudio.com/products/what-is-visual-studio-online-vs?WT.srch=1&WT.mc_ID=SEM_MqzVAfsq

Summary

In my view VSTS provides better value to development team(s) and better ROI to management; as it enables and empowers the developers to collaborate anytime from anywhere. In addition it helps the organizations to reduce / cut-down the DevOps cost and needless to mention Zero investment into serves/disk spaces. Whether you are a dev using VSTS or on-Premise TFS you are not missing any features and capabilities from any of the flavor, VSTS is just a preferred/better way (in my view).

Abstract

This article provides a broad overview of review process for the code written in C# using Visual Studio 2015 and also uncovers best practices for code review. Code Review is a very important part of any developer’s life. Code review is a technique which allows another developer (not necessarily working in same team or same feature within a team) to go over-n-through your code line-by-line and identify areas for improvement or point out holes.  Hence, code review is a process and not a technology. However, there are some tools available (covered later in this article) which can enable a developer to write good quality code.

Disclaimer

There are numerous guidelines and best practices software development teams follow and depend on. This article will uncover most of those but it may not cover all the best practices around code review. However, I want to assure you that all the guidelines mentioned below will help any individual to practice and apply good coding principles and perform a quality code review.

Is it must to have my code, reviewed by other dev?

Well, you must. But it depends on your team’s development methodology and ALM (Application Lifecycle Management) tool settings. There are ways to by-pass the code review by simply just not doing it and straight checking-in the code. It’s not recommended though.

What if my code is not reviewed?

It’s hard to say, but at times and in some cases it might cause serious issues and raise concern for the whole team. For instance, a condition check is missed, or null is not handled properly or not all error situations are being handled by your exception handling block. Well, these examples might sound very simple and most of the developers do write defensive code and cover such aspects. But what code review can also provide value towards is your “design”, “techniques”, “patterns”, “approach” etc.

How to find a code reviewer

I have worked in various team settings and work environments. Many times I have been invited to perform a code review for a developer who is not part of my team or rather I am not part of their team. But what I admire and appreciate here is the fact; that someone reached out to another dev in case of their team’s developer is either not available or busy with critical production issue etc. Such mindset empowers the team to deliver the best written code.

Let’s Begin with Best Practices of code Review

Here, I am going to list out some areas which are critical from code review perspective. I tried to highlight the core best practices which are must in any code review. I have seen many times that in a code review developers are more focused to look for code design patterns or some areas in code review and then try to convince

1- Project and File names

Many times developer’s only focus on code, but in my view your Project name, file name etc. also matters a lot. It’s not sufficient to deliver well written functional code; a well-defined project and file name is equally important and brings a lot of clarity by offering a sense of purpose being served by solution, project or a file. For instance see the solution and project name in as shown in the image below.


Figure-1: Properly named Solution and Project

2- Always begin from the top

Before you really start scanning through the code blocks/statements in a class (.cs) file; I would recommend that you must 1st look at the “using” statements in any .cs file. I have personally observed that many times developers add numerous “using” statements while trying various code blocks to achieve the functionality. But once that functionality is accomplished; many developers tend to forget about cleaning up references of those “using” statements which are no longer needed now and must be removed. Visual Studio 2015 show unused using statements in grey color which can be safely removed as shown in the image below.

Figure-2: Un-used using statements are grayed out by default in Visual Studio 2015

3-  Sort all the using statements

Usual development practice is that we keep adding new using statements at the end of previous ones, for instance as shown in the image below.

Figure-3: Newly added using statements

Let’s assume that code is consuming all of the added using statements, but the issue is that these are not sorted. One of the coding best practices is to Sort all using statements. To sort using statements right-click in code editor windows and click on “Organize Usings” then click on “Sort Usings”.

Figure-4  Sort Usings option in Visual Studio 2015

After performing the “Sort Usings” all the using statements will be alphabetically sorted (this is the only order A - Z) and will be arranged as shown in the image below.

Figure-5 Alphabetically Sorted Using statement

4- Don’t just ignore warnings

As a developer we are more focused on compilation errors and want to see that project/solution build successfully. For instance, consider the code as shown in the image below.

Figure-6 sample code

This is a very simple code and project will build successfully without any compilation errors. However, as you can see that “j” is used nowhere in the code and so this will cause a warning; which many developers doesn’t seem to care about. In my view and as many software companies including many Microsoft teams I have worked with enforce 0 warnings policy before check-in. Hence, it is very important to look in detail at the “Error List” View menu à Error List, and then observe Warning Tab and must try to have that also show “0 Warning” just like we always work to only see “0 Errors”.

 Figure-7 Error List, highlighting warning in the code

5-  Code Consistency

One very important quality of well written code is “Consistency”. I.e. stick to one style. Let’s say that you want to declare an integer variable and it’s obvious that different teams and developers will have different coding guidelines. Many times developers ignore this and code has scattered instances of types/keywords Int32 or int and String or string, this demonstrates that code consistency is violated. However, using mixed statements will successfully compile the code but makes your code base completely in-consistent. 


Figure-8 Code consistency violation

6-  Do care for Null all the times

Null has catastrophic impact on your code functionality. Simply a null check ignored and you will face the consequences. This is why many developer productivity tools like Re-Sharper prompt for any potential “NullReferenceException” which can be triggered from your code. Make sure that all your if/else do take enough care of null and have guard(s) in place, most of the times IsNullOrEmpty or IsNullOrWhiteSpace will come really handy.

7-  Dead code

Many times I have seen that as a developer we are mostly interested in our own code; to be specific, code we are writing. At times we do observe a block of code which is commented for long, but we don’t seem to care, but why not?  Well, in my view there are two reasons for this. First, I don’t care as long as my code works. Second, I am working in an agile team and I am committed to finish my task in committed timelines. First one is an attitude problem, second is timeline and hours remaining to complete the work. But both can do one thing for sure. Open an item in Technical Debt backlog with details to have that file cleaned up.

8-  Naming Convention

All developers today are well aware of Camel and Pascal casing and when to use one over the other. For instance variable and parameter names must follow Camel casing and for class, function, and method names Pascal casing must be used. Make sure this basic principle is applied consistently.

9-  Code Readability

Many times code is written in a way that anyone can hardly make sense out of it. I.e. all code is so jumbled up and one line after the other that it’s barely readable. Make sure that code has proper Single line spacing wherever applicable between the code blocks.

 10-Handling Unmanaged Resources 

Even though .NET Framework takes good care of Memory management via GC (garbage collection) but there are limitations on what all garbage items and from where those can be collected and what not. Many times, it’s wise to handle cleaning of expensive resources like File I/O handles, connections, Network resources, etc. by yourself. Such items can be disposed of once their usage is over and this can be done using the “using” block for unmanaged code, if you want to automatically handle the disposing of objects once they are out of scope.  Another good place to handle such code is finally block for example, File I/O operation to read a file as shown in the image below.

Watch my YouTube channel video on FIle I/O here:

Figure-9 Handling unmanaged resources by .NET’s StreamReader

11-    Write Defensive Code

.NET Exception Handling is the key to write defensive code and protect your application against any runtime anomalies. Three magic words to solve most of your problems are try/catch and finally. Proper implementation and usage of Exception Handling and logging any exception messages and details can add a lot of value to application in terms of application monitoring and troubleshooting.

12-    Declare access specifiers explicitly

C# .NET has default scope defined for various types for instance a variable is private by default and so in a class we like to write just “int i” but it’s more appropriate to be declarative and instead write it as “private int i”.

Do you know what default scope of a class is in C #? Watch my YouTube channel video here 

13- Self Documenting code

Many times developers do follow naming convention (camel or pascal etc.) but the given names to variables, methods, functions and class etc. are not meaningful at all. Hence, at times developers write long code comments to describe what is the  purpose of each function or variable for instance. In my view, giving “self-describing” names will add a lot of value and also save developer’s time in documenting the code; as many software teams have a practice of writing comment above each line of code to explain the objective of code below. For instance, instead of “int age;” you may want to declare “int studentAge;”. Similarly, instead of just writing a function with name “GetData()” it will be preferred and more helpful to say “GetStudentsReportData()”. Similar techniques can also be applied to class names, functions and Unit Tests etc. But in case of unit tests, name(s) might get really lengthy, but this is totally fine and acceptable. Hence, a unit test method name “TestSuccessWithOneStudentRecordAddedToDb” will be much preferred than just saying “TestOneRecordData”.

Summary

Above mentioned code review guidelines are light weight, easy to look for and easy to apply techniques with larger impact on any code base.  Mostly it has been evident that simple things are either ignored or not cared about. These best practices can be added up with more guidelines or in combination with other techniques as applicable. Happy Coding…

Sybase is another Relational Database Management System (RDBMS), it has long well established history.  Today Sybase is part of SAP (Since November 2012). But in earlier days Sybase and Microsoft has worked together.

In 1986 Microsoft and Sybase worked together to build a product called Ashton-Tate/SQL Server 1.0. Later in 1993 they dissolved partnership and Microsoft got the code base of SQL Server side of the product and continued their investments into it to have it more adaptable for Windows.

As Sybase and SQL Server has same roots and the core code base which is closely tied with each other then it’s safe to assume that their syntax is very close to each other if it is not 100% same to same.

Besides, I have worked on Oracle in quite detailed level and then I completely focused on Microsoft Technologies. While working with SQL Sever I learned that all databases are derived from some standards like ANSI SQL. Hence, syntax of any two database won’t be much different and besides all of those have support for same database constructs like JOINS, SETS, Query Operators etc. including db objects like Tables, Indexes, Views, Triggers, Stored Procedures etc.

However, I can say that some database may showcase different syntax over another, for example I recall that in Oracle 7.3 for Left Outer Join the operator was “*= ” whereas in SQL Server you can say “LEFT OUTER JOIN”.

So, if someone is really focused on Syntax part and hard core fundamentals concept then it is very easy to reduce the learning curve of any new technology.

 

Abstract

After many years in IT industry I have personally experienced and learned from other’s experience that; it’s up to us that how someone can make us feel about our self. In my long tenure in IT industry there is not a situation I have not been through. Today, I thought of providing some insight and share some common issues and counter approaches to those.

Note

Be informed that I didn’t mean to target any person or group or a title or role in IT industry. All the points below are my personal experiences and what I keep hearing from my connections in various continents across the globe.

I hope you will be able to read between the lines and apply some of the suggestions and work on building a better career.

My wish for you

I do wish all the success and happiness to all of you, and I really do. I also wish that you have a great future and career path.

#

Learning from Past

Resolution for New Year 2016

1 Don’t sit late in office. When you do that, you encourage wrong expectations. However, there are always exceptions. Reach the office on time and leave the office on time. This will allow you to spend time on yourself or with family. Be aware that sometimes critical deliverable, production issues, etc. may push you to start early and finish late.
2 Don’t be afraid of losing job and live with this fear year after year. Always remember that companies need good resources, so your job is to bring value to the company and team and stop worrying about it.
3 Be nice but not weak Don’t encourage bossy behavior in the team from anyone. Be nice and polite, but stay strong at the same time.
4 You say “YES,” when actually you wanted to say “NO.” Listen, plan, and then act accordingly. Even if you have to say “Yes”  then understand the expectations before you commit on such a task.
5 Asked to work on an unrealistic deadline Your hard work bring value to company and team. Many times working on tight and critical deadlines require a lot of planning, dedication and focus. Be ready to go above and beyond and if this is not your cup of tea, then let your superior know.
6 All your work’s credit was either stolen or given to others. Make sure that your work is properly recognized and appreciated. Don’t allow anyone, I mean anyone, to steal the credit of your GREAT work and white label that with their name.
7 You don’t think proactively and plan your career. Come out of this “job” mindset and think more in terms of  a long term career.
8 You learned nothing, or very little. Learn the technology of your focus area;  this year buy more books and read at least 50% of each book(s) you have.
9 You didn’t focus on your weaknesses. If you know your weaknesses, then work on those this year. A little progress on a daily basis will reap great results.
10 You don’t have a link with LinkedIn. LinkedIn is a good social media resource to connect with like-minded people, join technology groups and read articles etc.
11 You have no time after your job. I would agree that you must have been very busy with office work. I suggest that stop time-management; instead, manage your focus this year.

Shift your focus from job to career, and every day when you go to work, look for what will help you build your career.

12 Everything is good and you are comfortable.
Remember, the enemy of the best is not the worst, it’s what is merely good. So if you think you are doing well and you’re comfortable then you are at the wrong place, and this comfort zone is a sweet poison. So seek knowledge, challenges, and growth in your career.
Seek challenges in your current role, try to learn what it takes to own/observe more responsibilities.
* Learning Resources Read More Career Related Articles Here…
Listen Career Realated Podcasts Here…

 Summary

Based on above points, I trust that all of the points may or may not be applicable to everyone and it would rather be case to case basis; and upon self-realization of an individual. Hence, I do suggest that use this information as a tool and seek if you can get benefited. It’s very important that you read between the lines and get the right context from each suggestion I have provided.

I am now also contributing to Microsoft Channel9.
More videos are in production and will be available soon.

https://channel9.msdn.com/Niners/dotnetauthor

Visual Studio 2015 Feature Series #1 Account Management
Visual Studio 2015 Feature Series #2 Window Layouts

 Abstract

An IDE’s Code Editor is every developer’s playground. Being a developer requires a lot of seeing, thinking and coding of course. This is the place where most of our time is spent in various activities. I learned that small things make big difference. This article will explain some of the code editor enhancements made in Visual Studio 2015 to improve developer’s productivity; which will help the developers to code better, to see better and even have better touch support if you are working on a touch enabled device.

Colored Tool Tips

Tool tip is a useful feature when a developer want to look at preview of a code segment; by placing mouse pointer over the collapsed construct such as class definitions, structure definitions, and method bodies. Visual Studio 2015 enhances the too tip view by showing colors as per the usage of code, keywords and types etc. If you hover mouse on a type and observe the preview generated then you will notice that code is hard to read and figure out the type, keywords and code etc. are in plain black color as shown below in Figure-1.   Figure-1: Plain Black Tool tip preview in Visual Studio 2013 This has served the purpose for many years but it doesn’t give proper visual clues on types, keywords and code used. Now let’s have a look at Visual Studio 2015 Tool tip as shown in Figure-2 below. Figure-2: Colored Tool tip preview in Visual Studio 2015

Light Bulb and Quick Actions

Writing code is not easy and at times, some small productivity enhancement tips have big impact and give you some free time and take you away from thinking through of everything in terms of solving every error. What if Visual Studio code editor can itself suggest some actions; to resolve the issue? For instance, have a look at the Figure-3 shown below in which Visual Studio 2013 is showing an error when used ITest; which requires to explore some possible options to fix the issue on your own. Figure-3 Visual Studio 2013 Now, consider the same scenario in Visual Studio 2015, when you hover mouse on ITest then you will see a “Light Bulb” which will lead you to possible solutions, and this is really productive way of programming.  Figure-4 Visual Studio 2015, Light Bulb

Removing Un-used Using

One of the best coding practice is to remove all un-used using statements from your code. The easiest way for a developer has always been to use the option “Organize Usings” because Visual Studio code editor was not telling you while coding; that which using is not being used. I.e. as shown in Figure-5 below shows that all using are being used until a developer try to invoke “Organize Usings”. Figure-5 using in Visual Studio 2013 Visual Studio 2015 made this using business very institutive and developer friendly, so as soon as you start adding using statements you will know immediately if that is being used or not and you can remove those very quickly with much fewer steps in comparison to prior Visual Studio code editors. Figure – 6 Greyed out using statements in Visual Studio 2015 Now, it’s also easy to remove un-used using statements. Just hover mouse on using statements and click on the “Light Bulb”. Figure – 7 Using Light Bulb to remove un-used using statements

Inline Rename

I have personally found that “Rename” is the most widely used Refactoring option as many times you want to rename something in your code either due to self-realization or to address a code reviewer comment. Before Visual Studio 2015, the “Rename Workflow” was quite tedious and lengthy workflow, let’s quickly have a look via Visual Studio 2013. Let’s say in the code below; we want to rename msg variable to message and preview the changes before it’s applied on the code. static void Main(string[] args) { string msg = “Hello from C# Console App”; Console.WriteLine(msg); } In Visual Studio 2013, you need to hover on msg, Right-click and select Refacor à Rename then a dialog will pop-up as shown in Figure-8 below. Figure-8 Visual Studio 2013 Refactor à Rename Now when you proceed by clicking on OK button, the workflow continues and you will see a screen as shown in Figure-9 below, highlighting all potential changes to be made if you choose to Apply rename on those. Figure-9 Visual Studio 2013 Preview Changes (Rename) After changes are applied across the code, the code will now appear as shown below classProgram { static void Main(string[] args) { // msg Renamed to message string message = “Hello from C# Console App”; Console.WriteLine(message); } } Now let’s review this Rename process through Visual Studio 2015, in Visual Studio 2015 Rename option is available right away in the context menu as shown in Figure 10 below. Figure – 10 Rename from context menu Now when you click on the Rename it will highlight all the msg instances in code as shown in Figure-11 below.

Figure – 11 Preview of rename in action

Now click on msg (First green selected instance) and start renaming it to message for instance as shown in Figure-12 below.

Figure – 12 Inlined Rename in action

If you want to proceed with the code changes then click “Apply” on the dialog shown in code editor window and now code will be shown as below. classProgram { staticvoid Main(string[] args) { // msg Renamed to message string message = “Hello from C# Console App”; Console.WriteLine(message); } }

Touch Gestures

Touch Gestures is a powerful feature and can come handy occasionally; especially when you are either doing some R&D or reviewing a code or thinking of code enhancements using a touch-enabled device. If you are not coding and want to read through code and performs some basic operations then following touch gestures are supported by Visual Studio 2015 on a touch-enabled device.

  • Pinch and zoom; to zoom in and out with thumb and index fingers.
  • Single tap the margin of the code editor to select the line of code where you tapped.
  • Double-tap a word or an identifier to select it.
  • Press and hold on empty screen area to open the context menu.
  • Tap and hold anywhere on the code editor’s surface to scroll up and down.

Read Feature#1 Account Management in my previous article.

Abstract

Window Layout is a new Visual Studio 2015 feature related to developer’s productivity and ease of interaction with Visual Studio 2015 IDE. In previous version of Visual Studio developers were able to arrange windows as per their need but temporarily. Visual Studio 2015 extends this experience with some productivity enhancements.

Introduction

Window Layout is directly related to the way numerous windows are arranged and laid out in a Visual Studio IDE. IDE (Integrated Development Environment) is every developer’s tool for being creative, develop new things, being logical, fix issues, build and deploy various LOB (Line of Business) solutions etc.

Why Window Layout?

Different developer personality types like the windows to be arrange in specific way. Some like certain windows in the IDE and some like other windows. Some may like Pinned windows and some Tab styled.

Hence, Window Layout enables a developer’s to arrange the windows which they want and how they want and then save the layout for later use. Saved layout can be accessed from any machine on any device and applied to the IDE as long as that layout was saved to your Account Settings via Synchronization. Read Feature#1 Account Management in my previous article

So Window Layout enables you to arrange the IDE in a way you are most comfortable with and provides ease of use and productivity.

Which Windows are those?

Well, today Visual Studio 2015 stands mature and has a lot of windows which may appear in a developer’s screen wrapped into the IDE. For instance:

  1. Solution Explorer
  2. Team Explorer
  3. Server Explorer
  4. SQL Server Object Explorer
  5. Bookmark Window
  6. Call Hierarchy
  7. Class View
  8. Code Definition Window
  9. Object Browser
  10. Error List
  11. Output
  12. Task List
  13. Toolbox
  14. Class view

This list goes on and on, so let’s see the whole list via Visual Studio 2015 View menu.


Figure-1: Visual Studio 2015 View Menu

How to Save a Window Layout

Before you start saving a Window Layout, you to create one. Follow these steps:

1- Arrange windows (all which you work with mostly) in your desired way. For example as shown below:


Figure-2: Arrange windows in Studio 2015

2- Now let’s save this Window Layout. Click on Window menu and choose “Save Window Layout”


Figure-3: Save Window Layout menus option

3- Name the Layout properly so you can recall from the name and click OK.


Figure-4: Naming a Layout

4- Now Layout is Saved and Synchronized with your Account Settings.

Reset Window Layout

Once you have saved the Layout and you want to test it, you have to reset the layout to default layout which Visual Studio IDE brings to you.

Go to Window menus and click on “Reset Window Layout”


Figure-5: Reset Window Layout menus option

Once you click on this option, Visual Studio will prompt you to confirm that you want to restore the default window layout. Click on Yes.


Figure-6: Confirmation dialog to Reset Window Layout

Now, Your IDE will be re-arranged to default layout as shown in the image below. Which could be the one you are having right now in your Visual Studio IDE.


Figure-7: Default layout after Reset of the layout

Applying Saved Window Layout

To apply your saved Window Layout, go to Window menus and click on “Apply Window Layout” and choose one of the previously saved Window Layout. I have created and named my layout as “Pinned_Windows”


Figure-8: Apply Window Layout menu option

Click on “Pinned_Windows” layout and Visual Studio will show a confirmation dialog, click OK


Figure-9: Confirmation to Apply saved Window Layout

Now your layout will change to what you have saved and IDE will appear as shown below.


Figure-10: Saved layout applied

Manage Window Layout

As you can imagine you may end up with creating and cleaning up layout as per your needs. Hence, it become very important to manage the layouts which are created and available in your Account Settings.

You can easily manage the layouts via Window menu and “Manage Window Layout” option


Figure-11: Manage Window Layouts menu option

Once you click on it, a dialog will open and allow you to Rename, Delete etc.


Figure-12: Manage Window Layouts dialog

Summary

Custom Window Layout in Visual Studio 2015 is a brand new way of arranging the windows in the IDE and saving the layout. After saving the layout, it’s also easy to manage and restore the window arrangements. This feature certainly helps the developers to feel comfortable with their window arrangements and continue to be productive across the devices using Visual Studio 2015.

 

 Related Articles:

Inside Out: TDD using C#

Visual Studio and .NET Unit Test Framework

Unit Test Automation with Visual Studio

Introduction

Unit Tests play an important role in delivering high quality software solutions. An ideal unit test is a piece of code (automated test) written by a developer which exercises a small but specific area of code functionality to ensure that it works as expected.

Why Unit Test

According to the Test Triangle, in a software project the largest number of tests must be Unit Tests. Because multiple individual Unit Tests exercises small units of functionality which spans over entire various areas of functionality offered by the software solution.

                                       

Unit Test Check-List

While writing Unit Test(s) following points must be considered and followed by the Developers and SDETs.

Check

Description

  √

Self-Describing Names

Unit Test method names must be Self-Describing and Pascal case.  For example choose Add_New_Customer_With_Valid_AcccountNumber over AddCustomer_with_validAcc or addCustomer etc.Also focus on naming style, keep the naming style consistent across all the tests methods and test.

   [ ]

A3 (Arrange, Asset, Act)

Make sure that all the Test Methods are designed around Arrange, Act and Assert.If required Refactor your code to fall into these three sections.

   [ ]

Test Happy and Sad Path

The unit test should cover all possible scenarios and strive for high code coverage and ensuring good quality metrics. Unit Test methods must exercise all possible use case scenarios to test the input validations, interactions, errors messages, edge cases and exceptions etc.

   [ ]

Make use of Attributes

Use Test Framework provided Attributes like :

[TestCategory("<describe if its Unit or Integration Test>")]

[TestCategory("<Which section of the application is being tested>")]

[Priority(n), TestCategory("<define if it’s Gated or not-Gated build Tests>")]

[WorkItem(xxxx)]

[Owner("<who wrote this test>")]

   [ ]

Have least number of asserts per test (if applicable)

A good Unit test should only have limited # of assert statements. It should unit test the very functionality, as indicated in its descriptive name.A well-defined Unit Test should contain only one assert statement per test and must not try to exercise all the validation/boundary checks etc. by multiple Assert() in one Unit Test method. .

   [ ]

Keep assert messages descriptive

Use descriptive messages to improve readability of code and the build log.Assert.IsTrue(customer.IsExist,”The Customer is not found in the Database”);

   [ ]

Unit != Integration

There is a very fine line between Unit and Integration, if you happen to go beyond what your function is supposed to be doing then you are not writing a Unit Test. I.e. Unit Test doesn’t focus on interaction with external systems and software layers/dependencies.Test Doubles (for example Microsoft Fakes framework) comes into the picture to write unit tests which has dependencies on external libraries and systems etc.

   [ ]

Follow OOP Design and Adopt DI

Following Dependency Injection will allow to convert potential Integration Tests into small and quickly testable Unit Tests by taking advantages of Test Doubles (e.g. Microsoft Fakes, Moq, FakeItEasy frameworks etc.)

   [ ]

Should be thorough

Unit Tests are supposed to test all the possible areas of functionality that are subject to failure due to incorrect input/validation checks/boundary checks etc. for given function/method.

   [ ]

Must be Repeatable

Unit Tests must be repeatable for every build and must produce the same results. The development best practice suggests that if you are working on code that is impacting a Unit Test then you must fix the affected Unit Test as well and ensure that it passes.

   [ ]

Have to be Independent

Unit Tests must be independent of another test. In other words, no collateral damage. Hence, a Unit Test must focus only on a small aspect of big functionality. When this Unit Test fails, it should be easy to discover where the issue is in the code. I.e. can be tested in isolation

   [ ]

Keep it Professional

Even though at times Unit Tests may appear to be very simple and small, you must write Unit Tests with coding practices as good as you use for your main development coding. You may want to follow Refactoring, Code Analysis and Code Review practices and so on as for your Test Projects as well.

  [ ]

No Collateral Damage

Make Sure to Run all related Unit Tests after any dev code change big or small; to verify and ensure that no collateral damage occurs or has been introduced.

  [ ]

If you break it, You bought it

If you are working on a feature and to verify no collateral damage, as a best practice run all the Unit Tests. If you observe that some Unit Tests started failing because of your code changes then you own to Fix those broken Unit Tests to make sure that continue to pass.

  [ ]

Track and  maintain the tests

The test code changes should be tracked and maintained as on-going effort. Continue to follow thedesign principles and coding guidelines.

  [ ]

Code Review the Tests

Just like any other Dev code, Unit Tests also needs to be code reviewed by peer. Regardless of size of the test; follow the process.Code review might include reviewing the name of test method, scenarios covered, conditions checked, scope of assertions and code / design smells etc.

  [ ]

Abstract

Account Management is related to Sign-in feature; which was first time introduced with Visual Studio 2013. This feature has been helpful by various means, but Visual Studio 2015 even extends this experience with some enhancements.

Introduction

Account Management turned out to be very helpful feature, here are some points:

  1. Associate a profile (e.g. web development, C# or general) and synchronize your settings with the development environment once you are logged in to another workstation.
  2. Ability to select graphic themes (Light, Dark, Blue) for appearance of IDE, code and code editor window.
  3. Take direct benefits of MSDN subscription associated with ID, used to Sign In to Visual Studio. For example unlocking Visual Studio or manage licenses associated with Visual Studio.
  4. Automatic login to TFS service account; if subscribed to this. TFS Service is a Microsoft cloud based version of TFS.

Synchronized Settings

Visual Studio 2013 and 2015 allows the users to choose which settings to synchronize. Let’s first understand which Visual Studio settings are candidate for Synchronization.

  • Appearance I.e. Themes, Colors and Fonts.
  • Environment Aliases
  • Keyboard Shortcuts
  • Startup
  • Text Editor

Visual Studio 2013 Synchronized Settings will be as shown in the image below.

Visual Studio 2015 Synchronized Settings will be as shown in the image below.

 

Account Management

In Visual Studio 2013 and 2015; Account Management comes into the picture as soon as you click on “Sign In” option on the Top-Right of your Visual Studio IDE as shown below.

 Or Account Management settings can also be accessed via File –> Account Settings…

Improved Account Management with Visual Studio 2015

Microsoft has improvised Account Management experience for developers and made it better. The core change made in Visual Studio 2015 Account Management is the capability to store multiple accounts and have those listed and stored on that Account Setting page.

Immediate benefit for developers is the ability to log-in to Visual Studio with different associated accounts and work with different set of settings and projects.

Now question is what’s new in this; developers were able to this even with earlier version when it was introduced in Visual Studio 2013. Let’s see by diving deep into Account Settings.

 

Account Settings – Recap with Visual Studio 2013

When you Sign-in with Visual Studio 2013, your Account Settings page will open asking to Sign In.

After successful Sign-In Account Settings page will appear as follows.

 The very obvious issue here is related to developer productivity and a developer who switches between accounts, need to punch-in all different set of credentials repeatedly.

Enhancement to Account Settings in Visual Studio 2015

Visual Studio 2015 comes with an enhanced Account Management feature to enable developers to store multiple Sign-In credentials under Account Settings. Ideally, it would be productive to have multiple accounts registered and then switch easily from one account to another without re-punching all the credentials repeatedly.

Adding New Account

Clicking on “Add an account…” will take you to Sign In dialog as shown below.

After Successful credential validation the Account Settings page will display the newly registered account under All Accounts.

This feature enables developers to have a centralized place to manage accounts and Synchronize settings across every registered Microsoft account.