1. Visual Studio
2010
TimM@infosupport.com
13 februari 2012
2. Info Support Groep
Info Support Global
Info Support BV Info Support NV
Services
(NL, Veenendaal) (BE, Mechelen)
(BE, Echteld/Gent)
Create solutions
that innovate the way
organizations do their business
3. Info Support
Opgericht in 1986
Focus op IT vakmanschap
Alle jaren financieel gezond
en autonoom gegroeid
Actief in Nederland en België
Microsoft Gold Certified Partner voor
Custom Development Solutions Learning Solutions
SOA and Business Process Hosting Solutions
Business Intelligence Mobility Solutions
Information Worker Solutions Advanced Infrastructure Solutions
Business Solutions Competency (CRM)
Business Partner IBM en NL-JUG
Endeavour overview 3
4. Contents
Features of VS 2010
Team Foundation Server 2010
Unit Testing in VS 2010
Debugging in VS 2010
VS 11 (what’s next?)
Extending VS 2010
5. Intro
Microsoft Visual Studio is a powerful IDE that ensures
quality code throughout the entire application lifecycle,
from design to deployment. Whether you’re developing
applications for SharePoint, the web, Windows,
Windows Phone, and beyond, Visual Studio is your
ultimate all-in-one solution.
7. Team Suite
Visual Studio Visual Studio Visual Studio
Team Test
Team Team Developer Team Test
Essentials
Architect
Static Code Analyzer Load Testing Test Planning
Process and Architecture Guidance
UML Models
Code Metrics Lab management
Use Case Web Testing
Sequence Dynamic Code Analyzer
Activity Test Case Management
Schema Compare
Class
Data Compare Functional Testing
Component
SP unit testing Win Forms
Architecture Explorer Historical debugging WPF
Web (IE/FF)
Layer Diagram Test Impact analysis
DGML models Collectors for: Code Coverage, Test impact, System Info, video, etc.
Visual Studio Professional Edition
Team Foundation Client (includes CAL)
Visual Studio
Version Control Reporting Test Management Web Access
Team Foundation
Work Item Tracking Project Site Project Management Team Build
10. Most used Features of VS 2010
Solution <> Projects Code analysis
Build <> Debug – Quality
Multi languages – Metrics
NuGet Packager Most used Windows
– Server Explorer
Application Types
– Class view
– Web (project/website)
– Object Browser
– Win (WPF, Forms)
– Tasks list
– Cloud
– Bookmark window
– Database
– Command window
– Modelling
Architecture views
12. Intro
Developer Database
Designer
Professional
Architect
Tester
Business Project
Analyst Manager
13. Intro
Team Foundation Server
Process Focused
Version Control
Process
Templates Work Item Tracking
Integrated
SharePoint Check-in Build Automation
Manage work
Customizable Check-in
Bugs, Tasks, Reporting
Policies Continuous
Requirements, Integration
Shelving Stories, Risks, Decision
etc. Scheduled Support
Very Extensible Ad Hoc Track Project
Progress
14. Intro
Client Interface Version Control Build
Proxy Environment
Visual
MS Excel Command Line
Studio Version
Control Build
Proxy Process
Service
MS Project Team Explorer TFS SDK
Application Tier
SQL Reporting Services Windows SharePoint Services Web Services
SQL Server
Version Data
Work Items Team Build
Control Warehouse
Data Tier
15. Intro
Key concepts
– Process templates
– Workspaces
– Changesets
– Work Items
16. Demo
Create TFS project
Working with Work Items
Source control
– Checkin/Checkout
– History tracking/Diffing
– Merging changes
– Locking
– Shelving
– Checkin Policies
– Labeling
– Branching
18. Unit Testing in VS 2010
What is unit testing
How to create a unit test in VS 2010
Demo: Test first approach
Other features inside VS 2010 to help you unit
testing
19. What is unit testing?
A unit test is an automated piece of code that
invokes the method or class being tested and then
checks some assumptions about the logical
behavior of that method or class. A unit test is
almost always written using a unit-testing
framework. It can be written easily and runs
quickly. It’s fully automated, trustworthy,
readable, and maintainable.
20. What is unit testing?
Compile
Static Code Analysis
Integration Test
System Test
Acceptance Test
Performance Test
Robustness Test
Some other Test
Unit Test (Does not replace other tests, but makes
them more effective)
22. Benefits of TDD
Forces you to think about how you want to use
your classes.
Makes it impossible to write code you can not
test.
Automatically improves the quality of your
design.
– Test Driven Design
23. Writing a Unit Test With MSTest
Visual Studio has a specialized project type for
unit tests named “Test Project”.
We use the [TestClass] and [TestMethod]
attributes to make our tests known to the MSTest
framework.
Many Assertion methods are part of the
framework for your convenience.
24. Demo: working test first
The game consists of 10 frames as shown above. In each frame the
player has two opportunities to knock down 10 pins. The score for the
frame is the total number of pins knocked down, plus bonuses for strikes
and spares.
A spare is when the player knocks down all 10 pins in two tries. The
bonus for that frame is the number of pins knocked down by the next roll.
So in frame 3 above, the score is 10 (the total number knocked down)
plus a bonus of 5 (the number of pins knocked down on the next roll.)
A strike is when the player knocks down all 10 pins on his first try. The
bonus for that frame is the value of the next two balls rolled.
In the tenth frame a player who rolls a spare or strike is allowed to roll
the extra balls to complete the frame. However no more than three balls
can be rolled in tenth frame.
25. A quick design session
Game
+ roll(pins : int) Clearly we need the Game class.
+ score() : int
26. A quick design session
Game 10 Frame
+ roll(pins : int)
+ score() : int
A game has 10 frames.
27. A quick design session
Game 10 Frame 1 ..2 Roll
+ roll(pins : int) - pins : int
+ score() : int
A frame has 1 or two rolls.
28. A quick design session
Game 10 Frame 1 ..2 Roll
+ roll(pins : int) - pins : int
+ score() : int
1
Tenth Frame
The tenth frame has two or three rolls.
It is different from all the other frames.
29. A quick design session
Game 10 Frame 1 ..2 Roll
+ roll(pins : int) + score : int - pins : int
+ score() : int
1
The score function must
include all the frames,
and calculate all their scores. Tenth Frame
30. A quick design session
The score for a spare or a strike
depends on the frame’s successor
Next frame
Game 10 Frame 1 ..2 Roll
+ roll(pins : int) + score : int - pins : int
+ score() : int
1
Tenth Frame
31. Code Coverage
Every unit of code that contains logic is important
and should be tested
– Simple properties do not contain logic
– branching statements (if, switch case) and loop
statements (while, for, foreach) are considered logic.
Code coverage can help determine if every
important unit of code is tested.
A computer program can measure what source
code is executed during test execution.
33. Test Frameworks
Test Frameworks make it easier to write fully
automated, trustworthy, readable and
maintainable tests.
– JUnit (java)
– NUnit (.Net port of JUnit)
– MBUnit
– MSTest (integrated in Visual Studio)
34. Use Assertions in your Tests
AreEqual(expected, actual, message)
IsTrue(expression, message)
IsFalse(expression, message)
IsNull(variable, message)
IsNotNull(variable, message)
Lookup the Assert class on MSDN for more…
35. Test Impact Analysis
Test Impact Analysis shows you which tests need
to be re-run after a code change has been made.
Need to establish a baseline by running all tests
once Impact Analysis is enabled.
Any code changes after that will result in
recommendations on the “Test Impact View”
window.
– Only meaningful code changes will result in
recommendations.
– Changes in comments or changes that are optimized
away by the compiler (foo + 10 => foo + 5 + 5) are
ignored.
36. Debugging in VS 2010
Basics of debugging
Breakpoint options
– Conditions
– Tracing options
Change the debugging visualization
– Attributes
– Type Proxies
Intellitrace
37. Extending VS 2010
Project & Item templates
Extending the editor
Custom toolbar & menu commands
Extend the editor
38. Visual Studio 11 (what’s next)
C#: Async/Await
New features
– Search (assemblies, solution explorer, quick launch, error
window, ctrl-i window)
– Project roundtripping between VS2010 (SP1) & 11
Hinweis der Redaktion
CW:Edit.Replace, Edit.Find Controller /regex,Debug.EvaluateStatement 10 == 11, ?Nuget packager, install-package elmahDatabase projectSchema viewCompare schemaCompare dataArchitecturegenerate by methodSaturnus BSVerlofMngt dependenciesArchitecture windows explorer create dgmlDependency matrix viewHtml, JS, CSS
Debugging optionshttp://referencesource.microsoft.com/symbolsDisable just my code, enable ,net framework stepping, enable source serverRightclick on callstack
Async/Await class Program { static void Main(string[] args) { Console.WriteLine("Starting..."); var smsohanDotCom = GetSmSohanDotCom();Console.WriteLine("Passed the get line, status {0}", smsohanDotCom.IsCompleted); Console.WriteLine(smsohanDotCom.Result.Length);Console.WriteLine("Printed the length, status {0}", smsohanDotCom.IsCompleted); Console.ReadLine(); } private async static Task<String> GetSmSohanDotCom() { Console.WriteLine("Before Waiting...");var data = await new WebClient().DownloadStringTaskAsync(new Uri("http://smsohan.com")); Console.WriteLine("Waiting..."); return data; } }