PrepAway - Latest Free Exam Questions & Answers

Which isolation method should you use?

You are authoring unit tests. The unit tests must test code that consumes sealed classes. You need to create,
maintain, and inject dependencies in the unit tests. Which isolation method should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
T4 text templates and code generation

B.
Stub types

C.
Shim types

D.
Hard-coded implementation

3 Comments on “Which isolation method should you use?

  1. Test says:

    “Shim types are one of two technologies that the Microsoft Fakes Framework uses to let you easily isolate components under test from the environment. Shims divert calls to specific methods to code that you write as part of your test.”




    3



    0
  2. davinceleecode says:

    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 as .NET assemblies.

    https://docs.microsoft.com/en-us/visualstudio/test/isolating-code-under-test-with-microsoft-fakes?view=vs-2019




    0



    0

Leave a Reply