nuthanmurari
nuthanmurari

Reputation: 59

How do we write unit tests for MIP (Microsoft Information Protection) using C# programming language?

Requirement: If any file has protection(Sensitivity label) then we are throwing an error message.

Before we go and do our actual implementation, I want to achieve this using TDD approach.

Please let me clarify whether the below steps can we achieve using unit test with C#?

  1. Is it possible to write unit test on this MIP? If yes,
    • Through program , I want to read the file(.pdf or office app files) and apply sensitivity label before using MIP Code.
    • Once it reaches MIP code snippet ,this should detect this file and it has protection.
    • If it is protected then should throw an error message or else skip the execution.

Upvotes: 0

Views: 152

Answers (1)

OrcusZ
OrcusZ

Reputation: 3660

I never used the MIP SDK, but you are in the wrong path if you want to test the file information using MIP.

1. Use double testing

First you will have to use Double Testing (a stub or a fake) to be sure that you business rules are applied correctly in your algorithme (throwing the exception if the sensitivity level is bad for example)

The stub or the fake will allow you to control the sensitivity level return, It's also means that you will have to wrap the "MIP Library" inside a class or using IOC

2. Use integration testing

When you will have a first working scenario with you unit test, you will be able to make the same with Integration Testing. You will add to your project the material to have a "production environnement" adding files with differents sentivities to your test project

Conclusion

Of course, I know that my answer is not a working solution but your needs is not simple and cannot be set in a stackoverflow post. You will need to investigate about double testing & integration testing before making any development if you want to have reliable unit tests.

Upvotes: 0

Related Questions