Skip to content

Commit

Permalink
Test all Geocode Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bassmaster187 committed Jan 24, 2024
1 parent 7db6214 commit 8684ce6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:

# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet vstest /Tests:ParseGeocodeFile UnitTestsTeslalogger\bin\Debug\UnitTestsTeslalogger.dll
run: dotnet vstest /Tests:UnitTestsGeocode UnitTestsTeslalogger\bin\Debug\UnitTestsTeslalogger.dll
5 changes: 5 additions & 0 deletions TeslaLogger/GeocodeCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace TeslaLogger
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Keine allgemeinen Ausnahmetypen abfangen", Justification = "<Pending>")]
internal class GeocodeCache
{
public static bool useGeocodeCache = true;

internal static void CheckSchema()
{
if (!DBHelper.TableExists("geocodecache"))
Expand Down Expand Up @@ -114,6 +116,9 @@ internal static string Search(double lat, double lng)

internal static void Insert(double lat, double lng, string address)
{
if (!useGeocodeCache)
return;

try
{
using (MySqlConnection con = new MySqlConnection(DBHelper.DBConnectionstring))
Expand Down
6 changes: 4 additions & 2 deletions UnitTestsTeslalogger/UnitTestsGeocode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace UnitTestsTeslalogger
[TestClass]
public class UnitTestsGeocode
{
Car c = null;
static Car c = null;
Geofence geofence;

[TestInitialize]
Expand All @@ -22,10 +22,12 @@ public void TestInitialize()
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

GeocodeCache.useGeocodeCache = false;

var geofence = Geofence.GetInstance();

if (c == null)
c = new Car(0, "", "", 0, "", DateTime.Now, "", "", "", "", "", "", "", null);
c = new Car(0, "", "", 0, "", DateTime.Now, "", "", "", "", "", "", "", null);

geofence = Geofence.GetInstance();
geofence.geofenceList.Clear();
Expand Down

0 comments on commit 8684ce6

Please sign in to comment.