Test Driven Development Flashcards

1
Q

What’s the steps of TDD (TDD cycle)?

A

Write failing tests, make it pass and then refactor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How much code should be written on TDD?

A

Just enough tests and enough code to make the tests pass. Then some refactor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What’s TDD?

A

The continuous iteration of TDD cycle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are advantages of TDD?

A

Think about APIs;
Think about the code should do (not how yet);
Gest fast feedback (not even running the real app);
Decoupled implementation by design (modular code);
Write maintainable code;
Tests are good documentation;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are disadvantages of TDD?

A

Not so easy to start with the tests. Requires learning curve until be productive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does a simple .net core app architecture look like?

A

Four projects in the solution: DeskBooker.Web, DeskBooker.Core, DeskBooker.DataAccess, DeskBooker.Core.Tests, DeskBooker.DataAccess.Tests and DeskBooker.Web.Tests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to write code in the test project inside the same namespace as the DeskBooker.Core?

A

Define the default namespace in the .Tests project.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to create real classes from within the tests test project?

A

By creating the variables and then instantiating new objects with their real name so that you can ctrl + . to generate the class. Also, if you are creating POJOs, you can initialize the POJO with new MyPojo {property = “”} so that visual studio will create the class with the props already created.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which folder the POJOs needs to be stored in the DeskBooker.Core project?

A

In the domain folder. And the files in this folder should be in the DeskBooker.Core.Domain namespace.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When the files generated by the test stage should be moved?

A

In the refactor phase.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to convert a name of a class to string?

A

By using nameof method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the single responsibility principle?

A

A class or method should have only one reason to change.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the dependency inversion principle?

A

Components must depend on abstractions and not on implementations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which folder the repository interface needs to be stored in the DeskBooker.Core project?

A

In the DataInterface folder.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly