I have a Visual Studio solution with a number of projects. Most projects are for internal/intranet use, but a small handful are for public facing websites.
For internal projects, I use a ProjectName.Data
project with Entity Framework that access the database.
For the public projects, I use a different data access method which is only allowed to hit stored procedures in a certain schema.
As part of my integration/system testing, I want to ensure that these public projects do not have a reference to the ProjectName.Data
project (e.g., make sure some dev didn't say hey, there we go, I'll add a reference here and boom, easy access to the whole boat).
As part of my MSTest project for this public facing, I want to be able to do something like this:
[TestMethod]
[TestCategory("Integration")]
public void CheckNoAccessToDataProject() {
var ref = ProjectUnderTest.GetReference("ProjectName.Data");
Assert.IsNull(ref);
}
I did find a way to possibly shoehorn this by using Type.GetType("Full.Name.To.EF6.Context")
but I would much prefer to check the reference itself.
Aucun commentaire:
Enregistrer un commentaire