Skip to content

Commit

Permalink
detect Model 3 Highland
Browse files Browse the repository at this point in the history
  • Loading branch information
bassmaster187 committed Oct 3, 2024
1 parent f92adef commit 1570ae4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion TeslaLogger/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@
[assembly: AssemblyVersion("1.59.7.0")]
[assembly: AssemblyFileVersion("1.59.7.0")]

[assembly: InternalsVisibleTo("UnitTestsTeslalogger")]
[assembly: InternalsVisibleTo("UnitTestsTeslaloggerNET8")]
[assembly: InternalsVisibleTo("UnitTestsTeslalogger")]
10 changes: 10 additions & 0 deletions TeslaLogger/WebHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2707,6 +2707,11 @@ public void UpdateEfficiency()
WriteCarSettings("0.147", "M3 LR P 2024");
return;
}
if (car.TrimBadging == "74d" && year >= 2024)
{
WriteCarSettings("0.141", "M3 LR 2024");
return;
}
if (car.TrimBadging == "p74d" && year >= 2021)
{
WriteCarSettings("0.158", "M3 LR P 2021");
Expand Down Expand Up @@ -2755,6 +2760,11 @@ public void UpdateEfficiency()
WriteCarSettings("0.147", "M3 LR P 2024");
return;
}
else if (car.DBWhTR >= 0.135 && car.DBWhTR <= 0.142 && AWD && year >= 2024)
{
WriteCarSettings("0.139", "M3 LR 2024");
return;
}
else if (car.DBWhTR >= 0.135 && car.DBWhTR <= 0.142 && AWD)
{
WriteCarSettings("0.139", "M3 LR FL");
Expand Down
40 changes: 40 additions & 0 deletions UnitTestsTeslalogger/UnitTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,46 @@ public void Car_M3_LR_P_2024_MIC()
Assert.AreEqual(0.147, wh.car.WhTR);
}

[TestMethod]
public void Car_M3_LR_2024_MIC_Without_vehicle_config()
{
Car c = new Car(0, "", "", 0, "", DateTime.Now, "", "", "", "", "", "", "", null, false);
WebHelper wh = c.webhelper;

//2021 Model 3 LR Highland
MemoryCache.Default.Remove("GetAvgMaxRage_0");
MemoryCache.Default.Add("GetAvgMaxRage_0", 550, DateTime.Now.AddMinutes(1));
wh.car.Vin = "LRW3E7EK2RCXXXXXX";
wh.car.CarType = "";
wh.car.CarSpecialType = "";
wh.car.DBWhTR = 0.141;
wh.car.TrimBadging = "";
wh.UpdateEfficiency();

Assert.AreEqual("M3 LR 2024", wh.car.ModelName);
Assert.AreEqual(0.141, wh.car.WhTR);
}

[TestMethod]
public void Car_M3_LR_2024_MIC()
{
Car c = new Car(0, "", "", 0, "", DateTime.Now, "", "", "", "", "", "", "", null, false);
WebHelper wh = c.webhelper;

//2021 Model 3 LR Highland
MemoryCache.Default.Remove("GetAvgMaxRage_0");
MemoryCache.Default.Add("GetAvgMaxRage_0", 550, DateTime.Now.AddMinutes(1));
wh.car.Vin = "LRW3E7EK2RCXXXXXX";
wh.car.CarType = "model3";
wh.car.CarSpecialType = "base";
wh.car.DBWhTR = 0.141;
wh.car.TrimBadging = "74d";
wh.UpdateEfficiency();

Assert.AreEqual("M3 LR 2024", wh.car.ModelName);
Assert.AreEqual(0.141, wh.car.WhTR);
}

[TestMethod]
public void Car_M3_LR_P_2024_MIC_Without_vehicle_config()
{
Expand Down

0 comments on commit 1570ae4

Please sign in to comment.