How to ensure that a method can only be called from a specific dll

dexter

I need to prepare my database for unit testing and hence in the set up method I want to get rid of the data.

However, I don't want to be anybody else but the unit test dll to be able to call into my DeleteAllData() method in my Data Access Layer. What can be done?

MvdD

While others already suggested how to restrict code making calls to your method, they do not create a security boundary and can be spoofed (unless you sign both assemblies and verify the evidence).

Having a method in your business logic called DeleteAllData sounds pretty scary to me. If this method is only used from a unit test, I would probably move it to the unit test assembly. If that is not possible, I would at least put the code in a compiler directive to only compile in debug mode.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to verify that a specific method was not called using Mockito?

From Dev

How can I ensure that only one if a kind of Jenkins job is run?

From Dev

How can I ensure that a method is called (once, if present) for every class in a hierarchy?

From Dev

When a subclass overrides a method, how can we ensure at compile time that the superclass's method implementation is called?

From Dev

How can I ensure that correct function is called in case there are multiple candidates

From Dev

can an instance method be called from initializer block?

From Dev

How to ensure std::call_once really is only called once

From Dev

Ruby return in yield block called from a method with ensure

From Dev

How to check that method of a mockobject was not called only with a specific parameter?

From Dev

How to ensure a certain methods gets called in abstract super-class from method in sub-class (Java)

From Dev

How to ensure that new instance of class can be created only by other class?

From Dev

How can I show Lowest Price from a specific Country only?

From Dev

How to test if a specific method is called

From Dev

How can I make sure that a method of class can be called from a specific class only?

From Dev

How to ensure the presence of a dll

From Dev

How can ensure that a function only accepts a positive integer?

From Dev

How can I get only specific values from an Arraylist

From Dev

How can I ensure that only one if a kind of Jenkins job is run?

From Dev

Only validate if called from a specific controller in rails

From Dev

How can I ensure that correct function is called in case there are multiple candidates

From Dev

PHPUnit: how to mock one specific method in class which is called from not mocked one

From Dev

How to ensure std::call_once really is only called once

From Dev

How can I ensure an image is disposed of from method that returns an image

From Dev

method can't be called only from AJAX

From Dev

How can I ensure that my function is being called and running

From Dev

How can I access only one specific method from the UWP class?

From Dev

How can I ensure that the callback for setInterval is called exactly at the interval specified?

From Dev

How can i ensure a plot has a specific size when printed?

From Dev

How to ensure Fxml method on button will be called before listener on it?

Related Related

  1. 1

    How to verify that a specific method was not called using Mockito?

  2. 2

    How can I ensure that only one if a kind of Jenkins job is run?

  3. 3

    How can I ensure that a method is called (once, if present) for every class in a hierarchy?

  4. 4

    When a subclass overrides a method, how can we ensure at compile time that the superclass's method implementation is called?

  5. 5

    How can I ensure that correct function is called in case there are multiple candidates

  6. 6

    can an instance method be called from initializer block?

  7. 7

    How to ensure std::call_once really is only called once

  8. 8

    Ruby return in yield block called from a method with ensure

  9. 9

    How to check that method of a mockobject was not called only with a specific parameter?

  10. 10

    How to ensure a certain methods gets called in abstract super-class from method in sub-class (Java)

  11. 11

    How to ensure that new instance of class can be created only by other class?

  12. 12

    How can I show Lowest Price from a specific Country only?

  13. 13

    How to test if a specific method is called

  14. 14

    How can I make sure that a method of class can be called from a specific class only?

  15. 15

    How to ensure the presence of a dll

  16. 16

    How can ensure that a function only accepts a positive integer?

  17. 17

    How can I get only specific values from an Arraylist

  18. 18

    How can I ensure that only one if a kind of Jenkins job is run?

  19. 19

    Only validate if called from a specific controller in rails

  20. 20

    How can I ensure that correct function is called in case there are multiple candidates

  21. 21

    PHPUnit: how to mock one specific method in class which is called from not mocked one

  22. 22

    How to ensure std::call_once really is only called once

  23. 23

    How can I ensure an image is disposed of from method that returns an image

  24. 24

    method can't be called only from AJAX

  25. 25

    How can I ensure that my function is being called and running

  26. 26

    How can I access only one specific method from the UWP class?

  27. 27

    How can I ensure that the callback for setInterval is called exactly at the interval specified?

  28. 28

    How can i ensure a plot has a specific size when printed?

  29. 29

    How to ensure Fxml method on button will be called before listener on it?

HotTag

Archive