jeudi 26 février 2015

C# - EF 6 - MySQL: Error when calling method from unit test method

I have a solution, containing more than one project. Until now everything worked quiet well, even calling methods from referenced projects.


Now I tried to start using unit tests, so I could test different methods without running to whole overhead of GUI and so on.


I have a Form1 wich creates an instance of an entity model. This model is created from a MySQL Database. Instancing from Form1 does work without a problem, when I start the Form-Project. But when I reference everything in my unit test project, and just instance Form1, EF seems to have a problem. What I get is an instace of my entity model containing the following:




  • base {SELECT Extent1.ID, Extent1.extTicketID, Extent1.erstelltDatum, Extent1.erstelltMitarbeiterID, Extent1.firmenID, Extent1.ueberschrift, Extent1.inhalt, Extent1.typID, Extent1.gesichtetDatum, Extent1.gesichtetMitarbeiterID, Extent1.zugewiesenMitarbeiterID, Extent1.prioritaet, Extent1.statusID, Extent1.erledigtDatum, Extent1.erledigtMitarbeiterID, Extent1.projektNr, Extent1.projekt, Extent1.vonProjekt, Extent1.zeit_offen, Extent1.zeit_gesamt, Extent1.auftraggeberID, Extent1.reparatur, Extent1.linkTypID, Extent1.linkID, Extent1.erinnerung, Extent1.intervall, Extent1.intervallStunden, Extent1.reaktionszeit, Extent1.faellig, Extent1.zugewiesenAbteilungID, Extent1.kundeBenachrichtigen, Extent1.zubehoer, Extent1.niederlassung, Extent1.attention, Extent1.auftragDurchID, Extent1.gruppenID, Extent1.gesperrt, Extent1.pauschal, Extent1.pauschalBetrag, Extent1.eigen, Extent1.ogBetrag, Extent1.ogUserID, Extent1.deadline, Extent1.bezLTID, Extent1.bezLID, Extent1.IPFahrt, Extent1.instpauschID, Extent1.inhaltIntern, Extent1.wiedervorlage, Extent1.schliessen, Extent1.wvlText, Extent1.kostenstelleID, Extent1.phaseID, Extent1.wvlModus, Extent1.projektErstellerID, Extent1.aufwand_min, Extent1.kw, Extent1.laFlag, Extent1.bestellnummer, Extent1.laMaID FROM bug AS Extent1} System.Data.Entity.Infrastructure.DbQuery {System.Data.Entity.DbSet}



I have to mention, that I copied the connection string from that Form-Project App.config file.


I hope that you could give me a hint, on where the problem could be found. And I hope that the information above is sufficient.


Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire