exam questions

Exam 70-498 All Questions

View all questions & answers for the 70-498 exam

Exam 70-498 topic 1 question 92 discussion

Actual exam question from Microsoft's 70-498
Question #: 92
Topic #: 1
[All 70-498 Questions]

HOTSPOT -
You are the lead tester for Contoso, Ltd. The company is using Microsoft Visual Studio to develop a new software product.
Management wants to test the product as it is developed. Some components that require testing have dependencies that are not yet built or are otherwise unavailable.
You need to test the components.
In the table below, identify where only a shim or a stub can be used in the situation. Make only one selection in each column.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
* Interfaces and abstract methods. Stubs provide implementations of interfaces and abstract methods that can be used in testing. Shims cant instrument interfaces and abstract methods, because they dont have method bodies.
* Internal types. Both stubs and shims can be used with internal types that are made accessible by using the assembly attribute InternalsVisibleToAttribute.
In general, we recommend that you use stub types to isolate from dependencies within your codebase.
* Private methods. Shims can replace calls to private methods if all the types on the method signature are visible. Stubs can only replace visible methods.
Note:
* A stub replaces a class with a small substitute that implements the same interface. To use stubs, you have to design your application so that each component depends only on interfaces, and not on other components. (By "component" we mean a class or group of classes that are designed and updated together and typically contained in an assembly.)
* A shim modifies the compiled code of your application at run time so that instead of making a specified method call, it runs the shim code that your test provides.
Shims can be used to replace calls to assemblies that you cannot modify, such .NET assemblies.
Reference: Visual Studio, Isolating Code Under Test with Microsoft Fakes

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Currently there are no comments in this discussion, be the first to comment!
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...