Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[C#]Assemblypfad bei Unittest

Empfohlene Antworten

Veröffentlicht

Grüße,

Ich habe hier eine Anwendung mit Access-Datenbank, welche im Programm dynamisch geladen wird.

Ich hab daher im Hauptprogramm gesagt, dass ich einen Verweiß auf die Datei habe -> wird immer ins aktuelle Verzeichnis kopiert -> Datenbankservice läd über AppDomain.CurrentDomain.BaseDirectory + "File.Name" die Verbindung.

Jetzt wollt ich ein paar Unittests schreiben, habe einen Verweiß wie bisher auf die Datenbankdatei gelegt und "Copy always" gesetzt.

Problem ist nur, dass jetzt bei den Unittests AppDomain.CurrentDomain.BaseDirectory immer auf "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\" steht. Wie kann ich das umgehen, damit er den richtigen Pfad nimmt?

Projekt Eigenschaften -> Debuggen -> Arbeitspfad

Müsste helfen glaub ich.

Schade, hätte nun gedacht das dies evtl. genauso ist wie bei VB.Net.

Hab hier leider kein C# zum Testen.

2530d1240222371-c-assemblypfad-unittest-aufzeichnen.png

post-60296-14430448304733_thumb.png

  • Autor

Ich habs jetzt wie folgt gelößt:


string location = System.Reflection.Assembly.GetExecutingAssembly().Location;

location = location.Substring(0, location.LastIndexOf('\\'));

und dann halt location + "File.Name"...

Komisch, ich hab den Verweiß zur Datenbankdatei zwar im Testproject gesetzt und er kopiert mir auch immer fein die Datei in den Debug-Ordner des Testprojekts, allerdings nicht ins Out-Folder jedes Tests...

hmpf, muss ich halt die Datei immer im Programm kopieren. :rolleyes:

[Editerle]

Ahh, unter Debug - ja, da hab ichs grad gefunden, aber das lößt mein Problem sicher auch ne.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.