Presentation is loading. Please wait.

Presentation is loading. Please wait.

Build Robust Web Apps in the Real WakeUpAndCode.com * aka ASP.NET 5 before RC1.

Similar presentations


Presentation on theme: "Build Robust Web Apps in the Real WakeUpAndCode.com * aka ASP.NET 5 before RC1."— Presentation transcript:

1 Build Robust Web Apps in the Real World @shahedC WakeUpAndCode.com * aka ASP.NET 5 before RC1

2

3 Background > Getting Started > Writing and Running Tests > Dependency Injection & Mocking What’s Next?

4

5 > Nothing new to learn > Error-prone > Expensive > Slower

6 > Less human error > Faster! > Decreasing costs > Learning curve

7 Legacy New/ Improved Design Patterns S.O.L.I.D.TDDRefactorRestructure SRP OCP LSP ISP DIP

8

9

10

11 Unit TestsIntegration TestsUI Tests

12

13

14

15

16

17

18

19 public test class [Fact] for public methods without parameters [Theory] and [InlineData] for methods with parameters

20 Build Solution Run Tests in Test Explorer

21 Verify actual result against expected result Note “var” keyword

22 Verify that expected view equal to returned view

23

24 Temporarily ignore tests with an optional message.

25 Correct Views? Redirect to URL? Correct Models? HTTP Code? Mock Depen- dencies! Model Populated?

26

27 Dependency Injection Inversion of Control

28 In Startup: Add namespace and dependencies In Application Code: Constructor Injection Setter Injection

29

30

31 Mocks Pre-programmed with expected results, doesn’t actually connect to DB, behavior verification. Fakes Working examples, but not production-ready (e..g in-memory database) Stubs Provides canned answers

32

33

34

35 Smoke Tests New Features Edge Cases

36 Cost of Adding Unit Tests Cost of Not Having Unit Tests Bugs Features Expenses

37 Views & ViewModels Controllers Service Layer Repository Layer Entity Framework (ORM) SQL Server (database)

38

39 60 to 80% coverage ok?

40 Databases File Systems Network Resources Web Requests & Responses

41

42 Background > Getting Started > Writing and Running Tests > Dependency Injection & Mocking What’s Next?

43 Email: shchowd@microsoft.com Twitter: @shahedCshchowd@microsoft.com@shahedC


Download ppt "Build Robust Web Apps in the Real WakeUpAndCode.com * aka ASP.NET 5 before RC1."

Similar presentations


Ads by Google