⭐ 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 6

 In part 6 I continue doing some Test Driven to actually make our unit test go to the green state. I also show some quick ADO.NET Entity Framework use and finally how to check-in your code to Team Foundation Server while associating that check-in with the developer task.

0:00

hi my name is hula castle and in this

0:02

video we will continue the work that we

0:05

were doing in the past video trying to

0:08

make some test driven development in the

0:10

studio 2010 ok and a also learning how

0:16

to check in your source code into the

0:19

team foundation server associating these

0:21

without work item so if you remember we

0:24

were we just created our first giving

0:28

test in the trust even development way

0:30

where we're just instigating a new

0:33

instance well sorry a new instance of

0:35

the money your class and getting a

0:37

little books and asserting it is not

0:39

known as you already know this is just

0:42

not passing right click there this is

0:44

not bad so how to make this actually

0:47

pass let's close this and quick notice

0:50

we are going to use a database for this

0:53

exercise if i open my sequel server

0:57

management studio let me show you we are

0:59

using the pups database are very popular

1:02

and old database k back from the sequel

1:06

server 2000 days and it's a simple

1:08

database that has some information on on

1:11

books okay books book sales and that

1:13

stuff so we will be using the database

1:15

you will easily find that in the in the

1:17

web so and what we want to do now is to

1:21

go to the bookstore that business

1:22

applique project click add new item and

1:28

let's go to the data category and select

1:32

a do net entity data model be here let's

1:37

add a new model and let's let's use some

1:41

useful name let's call these pups

1:44

entities as we will be using some

1:47

entities from the pups database solidly

1:49

hit add okay so we will select generate

1:55

from the database ok this is this is our

1:59

database sinkhole express that part of

2:01

the VoIP you don't have this this option

2:03

right here just click new connection and

2:06

go ahead and create your connection so

2:09

let's call these pups entities this is

2:12

the name in the application corporation

2:13

file well the connection string will be

2:15

created in here a vicious to this

2:19

retrieving all the objects that it's

2:21

finding in this database for now we will

2:23

just select the tables and let's name

2:27

this pups model and let's click finish

2:29

so well this wizard is going to do right

2:32

now is adding all the references to the

2:34

idea that net entity data model and it

2:38

is creating or our diagram or entities

2:42

diagram will Elise just as you can see

2:44

right now it is placing all the tables

2:47

that we selected from the wizard and

2:49

it's also adding all the references from

2:52

these tables so it is a very useful

2:55

model for our job so we will be very

2:59

interested in this title in this title

3:02

table so let's go here and let's go to

3:06

the book manager class which right now

3:10

has a get boot list method which has

3:13

something that we don't really want to

3:14

have right there so what we want to do

3:17

now is to write the code for this so

3:20

let's just delete this and we will just

3:23

use some link to entities to retreat the

3:26

information that we want and we want to

3:29

retrieve information remember from this

3:32

title table let me do this ok so we have

3:38

some idea what we're doing here ok we

3:43

want to retrieve information from title

3:45

table and on the fly we will just create

3:48

instances of the book of the book class

3:52

that we already defined it in the or in

3:54

our test how to do that so first thing

3:58

to do we need a context to do this so we

4:01

will just call pops entities let me go

4:03

back to the other intelligence

4:05

configuration control out space bar this

4:08

makes it easier to select a obvious that

4:11

we already have so pops entities let's

4:14

call it context equals new pops entities

4:18

so let's say we want to borrow books

4:26

variable and let's say select from be4

4:30

book in context that titles okay which

4:35

is a table we want to get in for from

4:38

select what are we going to select a new

4:41

book okay so this book it will be made

4:49

off of the following a privates let's

4:50

say an ID we also always record an ID

4:53

which is B dot title ID okay as you can

5:00

see we don't have an ID attribute so

5:03

let's just create it in your

5:05

appropriately stop for ID in books or

5:07

business book okay it now exists now

5:13

let's go for title equals B dot title

5:18

won okay we will create all this stuff

5:23

in the end type equals V dot sorry be

5:30

that type okay price equals B that price

5:44

and final one will be description equals

5:53

B that pop date okay let's create all

6:00

these and ops what am I doing here skull

6:04

my coma coma so let's create a title

6:09

properly okay let's create the

6:21

description property okay

6:31

okay so a little mistake here this will

6:34

be a small T and small p now that we did

6:39

that get a property for type and genera

6:43

property full price now let's just close

6:46

this column there we go so we are

6:49

creating a new book this book if I hit

6:52

ok let's go to definition you can see

6:56

the book class now has all these

6:59

attributes this properties and now what

7:03

we want is to return these books this

7:08

book's variable but convert them into a

7:11

list so we to do list and that's it this

7:17

should be working now and but just a

7:20

small a small addition let's do this ok

7:24

and let's open this a little bit you see

7:27

this application configuration file this

7:30

one a has the connection string and for

7:32

this test for the test around we will

7:34

have to add a new configuration file

7:36

into the test project let's add sorry

7:41

let's right click and add new item and

7:49

in this list let's use application

7:52

configuration file so this is the

7:54

configuration for the test let's copy

7:57

the connection string and place it here

8:00

and that's it if we go now to our test

8:05

class right click and hit run tests okay

8:10

the test will be wrong this time using

8:13

our brand new implementation and as you

8:16

can see we get ring so the test is now

8:18

passing very easy final task as we have

8:23

already finished this let's right click

8:25

here and we need to add this search into

8:28

source control so they we just hit

8:29

check-in let's say

8:36

get book list method implemented okay

8:44

you see this is all the source that you

8:47

are chicken in and a good practice

8:49

always always go to work items and

8:52

select the work item that you are there

8:54

is related to this check in get it is

8:56

very important for tracking layering the

8:59

in the project so build the book list

9:01

screen check here okay as this is not

9:05

really resolving all the all the task so

9:07

we will just associate it at the cds for

9:10

for this time so let's hit check-in ok

9:17

so that's it

 

No comments:

Post a Comment