⭐ If you would like to buy me a coffee, well thank you very much that is mega kind! : https://www.buymeacoffee.com/honeyvig Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies

Friday, November 7, 2025

Working with Visual Studio 2010 - Part 5

 

0:00

hi my name is Julio Cel and in this

0:03

video I will show you how to do some

0:05

test driven development in Visual Studio

0:07

2010 and also how to associate your

0:11

source source code uh check-ins with

0:14

Team Foundation server or items now

0:16

remember that we are using H beta 2 of

0:19

Visual Studio 2010 and team Foundation

0:22

server

0:23

2010 okay so so far we have H planed our

0:28

our Sprint or iter

0:30

we have um a team project we have a team

0:33

ready to work so what we want to do now

0:37

as a first um coding task is to do some

0:41

test driven development you know uh this

0:44

approach to development means that you

0:47

will first create your tests and only

0:51

after creating the test you will start

0:53

writing some code so Vis Studio 2010 has

0:56

some very nice additions for doing this

0:59

kind of development

1:00

so how do we start on this let's go to

1:03

visual studio now for this session I

1:06

will be taking the role of the developer

1:08

and this will be hulas in the in this in

1:13

this demo so let's add the the team

1:17

project let's use the appropriate

1:21

credentials

1:23

okay so log it in as a developer I will

1:27

connect and I I want to do this because

1:30

first thing I want to do is to check

1:33

which are my tasks I have some test

1:35

assigned so far you can see this from

1:37

the query be from the team queries the

1:40

my test query is returning me three

1:42

tasks and the one that I want to start

1:45

with is the one that is called build the

1:48

book list screen okay so how do we do

1:51

this in the test driven development way

1:54

uh okay let's close let's just close

1:57

this oh sorry let's close this

2:01

and what we want to do is to create a

2:04

solution rank new solution let's go file

2:06

new

2:10

project okay and from the available

2:14

templates let's go

2:16

to uh Visual Studio Solutions let's pick

2:20

an appropriate directory for this I will

2:26

use this folder and let's call this

2:31

bookstore okay make sure you you check

2:34

this check mark at to solution control

2:38

okay bookstore and let's click

2:44

okay so now Visual Studio is asking us

2:48

for which H folder into the source

2:52

control we want to place this rank new

2:54

solution so let's say um in the source

2:59

control we will call this um source so

3:04

into in your Source control you will if

3:06

you go to the bookstore SL searce pad

3:10

you will find all the files related to

3:12

this solution so let's just click

3:15

okay okay so just to make sure uh we got

3:18

the idea let's go to Team Explorer okay

3:22

let's close more items and open source

3:23

control and you can see that inside

3:26

bookstore there's a new folder called

3:28

source and inside Source there's

3:30

bookstore dos solution okay the plus

3:32

sign means that these files are marked

3:35

for addition in the next checking but

3:38

they are not still over there they're

3:40

just it's like a mark on these files so

3:43

let's close that and what we need to do

3:45

this this time uh let's first create a

3:49

couple of projects okay first thing to

3:52

create is will be um class

3:55

Library okay this is the class Library

3:58

uh remember we have been a Windows

4:00

application uh bookstore Windows uh

4:03

client and we will basically use uh two

4:06

projects for this which will be a class

4:08

Library we will call business and a

4:11

Windows um WPF

4:14

application

4:15

ER to display all the all the data so

4:20

let's call this

4:23

bookstore

4:24

do

4:26

business

4:28

okay here hit

4:34

okay so now that we have that we will

4:38

also need some uh project for the tests

4:42

first let's just delete this class one

4:45

class we don't need that and let's add a

4:48

new

4:49

project we will go to test test project

4:52

and let's call

4:54

it bookstore.

4:57

tests okay

5:00

so we will start with um we will need to

5:05

get a list of all the books in the in

5:07

the database so how to do that well

5:11

let's figure it out in our unit test

5:15

so we get here a brand new file called

5:18

unit test

5:20

one okay we will just um we'll rename

5:24

this

5:26

one okay let's call it

5:29

we will be working on a book manager

5:32

class this book manager will be in

5:34

charge of retrieving and Performing all

5:36

the actions H towards the database so

5:40

let's call this bop bager

5:44

tests okay let's hit yes so the class is

5:48

also renamed and we already have some uh

5:51

method stop here and we will change this

5:57

into get

6:00

book

6:01

list do

6:03

not return n okay this is a very basic

6:07

test okay keep in mind this is a short

6:09

video so we will just we will just want

6:11

to get a list of the books and make sure

6:14

it is not null okay so to do this we

6:17

will just use

6:19

the let's

6:22

hit book manager okay the quick tip here

6:26

to use the suggestions from the

6:27

intelligence you can do control alt and

6:30

space bar okay this makes stuff easier

6:34

so let's say book bager

6:37

manager equals oh sorry book manager

6:42

okay you can see this small U indicator

6:45

here if you open it you can generate a

6:48

class for this uh book manager you can

6:51

just click here but we want to do this

6:53

generate new type over here because we

6:55

want to place this into the business

6:57

Library okay let's click create a new

7:00

file book manager CS okay so the book

7:03

manager class is already created if we

7:05

hit F12 we go to the book manager class

7:08

it is in the business Library okay back

7:12

in the test we say equals new book

7:18

manager okay and we want to get a list

7:21

of what of

7:23

books

7:25

okay we call it books and seems like we

7:29

we don't have a book class so we we want

7:32

to do is to generate a new type call it

7:37

a book Into The bookstore. Business

7:39

Library hit

7:41

okay so this is equals to

7:45

manager. get book list but again we

7:48

don't have this new method so maybe you

7:52

already know how to do this let's let's

7:55

just generate a meod stop for getbook

7:58

list and finally let's assert on

8:03

this okay is not

8:06

null okay so we want to make sure that

8:10

books is a not new H object basically so

8:15

now that we have this what we want to do

8:17

is try to see if this test will pass so

8:20

let's just right click run

8:24

tests okay this will build the solution

8:29

and you can see that the test is not

8:32

passing as expected if you right click

8:35

here and let's see for example view test

8:39

results details you can see that the

8:41

test method get book list not return

8:43

return n to reception not implemented

8:45

exception which is expected because we

8:48

have that into the getbook list

8:52

method

8:55

so given the very small amount of time

8:58

for this video this will be a two-part

9:00

post so this is the end of the first

9:03

part and in the second part you will see

9:05

how to actually fix this uh error we're

9:09

getting here and how to make this uh a

9:13

green uh passive test okay so see you in

9:16

next part

No comments:

Post a Comment