Update to .net 10
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Diagnostics.EventLog" Version="9.0.10" />
|
||||
<PackageReference Include="System.Diagnostics.EventLog" Version="10.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
uCSSystem.ConnectionState = true;
|
||||
Assert.AreEqual("border-success", uCSSystem.TableColor());
|
||||
|
||||
uCSSystem.Devices = [new UCSDevice() { State = true, Id = 1, UCSSystem = uCSSystem }];
|
||||
//uCSSystem.Devices = [new UCSDevice() { State = true, Id = 1, UCSSystem = uCSSystem }];
|
||||
uCSSystem.Devices.Add(new UCSDevice() { State = true, Id = 1, UCSSystem = uCSSystem });
|
||||
Assert.AreEqual("border-success", uCSSystem.TableColor());
|
||||
|
||||
uCSSystem.Devices.Add(new UCSDevice() { State = false, Id = 2, UCSSystem = uCSSystem });
|
||||
@@ -42,10 +43,11 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
uCSSystem.ComputerName = "PXX-1234";
|
||||
Assert.AreEqual("PXX-1234", uCSSystem.ComputerNameWithError());
|
||||
|
||||
uCSSystem.Errors =
|
||||
[
|
||||
new EventLogError() { Id = 1, Message = "error", UCSSystem = uCSSystem, Index = 123, TimeGenerated = DateTime.Now.AddDays(-2) },
|
||||
];
|
||||
//uCSSystem.Errors =
|
||||
//[
|
||||
// new EventLogError() { Id = 1, Message = "error", UCSSystem = uCSSystem, Index = 123, TimeGenerated = DateTime.Now.AddDays(-2) },
|
||||
//];
|
||||
uCSSystem.Errors.Add(new EventLogError() { Id = 1, Message = "error", UCSSystem = uCSSystem, Index = 123, TimeGenerated = DateTime.Now.AddDays(-2) });
|
||||
Assert.AreEqual("PXX-1234", uCSSystem.ComputerNameWithError());
|
||||
|
||||
uCSSystem.Errors.Add(new EventLogError() { Id = 2, Message = "error", UCSSystem = uCSSystem, Index = 1234, TimeGenerated = DateTime.Now });
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
string json = "";
|
||||
string device = "testdevice";
|
||||
string location = "somewhere";
|
||||
var message = MQTTDeviceMessage.Deserialize<TeltonikaMessageV2>(json, device, location);
|
||||
TeltonikaMessageV2? message = MQTTDeviceMessage.Deserialize<TeltonikaMessageV2>(json, device, location);
|
||||
Assert.IsNull(message);
|
||||
|
||||
json = "lufhy2q9478ry78aq39 f3g789fy egy 3ghuieg heasuhg egh eisulgh uielg hsalgire";
|
||||
@@ -149,6 +149,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
Assert.AreEqual(location, message.Location);
|
||||
|
||||
//Temp
|
||||
Assert.IsNotNull(message.GSM);
|
||||
Assert.AreEqual(380, message.GSM.Temperature);
|
||||
Assert.AreEqual(38.0, message.GSM.TempValue());
|
||||
Assert.AreEqual("38℃", message.GSM.TempString());
|
||||
@@ -164,7 +165,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
//Assert.AreEqual("1 days 3 hours 58 min 0 sec", message.Base.UptimeString(new DateTime(2023, 10, 9, 0, 0, 00)));
|
||||
|
||||
|
||||
|
||||
Assert.IsNotNull(message.Usage);
|
||||
//ThisMonthRX
|
||||
Assert.AreEqual((UInt64)30888399, message.Usage.Rx);
|
||||
//ThisMonthTX
|
||||
@@ -205,6 +206,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
|
||||
|
||||
//Temp
|
||||
Assert.IsNotNull(message.GSM);
|
||||
Assert.AreEqual(390, message.GSM.Temperature);
|
||||
Assert.AreEqual(39.0, message.GSM.TempValue());
|
||||
Assert.AreEqual("39℃", message.GSM.TempString());
|
||||
@@ -220,7 +222,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
//Assert.AreEqual("1 days 3 hours 58 min 0 sec", message.Base.UptimeString(new DateTime(2023, 10, 9, 0, 0, 00)));
|
||||
|
||||
|
||||
|
||||
Assert.IsNotNull(message.Usage);
|
||||
//ThisMonthRX
|
||||
Assert.AreEqual((UInt64)24069, message.Usage.Rx);
|
||||
//ThisMonthTX
|
||||
@@ -304,7 +306,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
string device = "testdevice";
|
||||
string location = "somewhere";
|
||||
|
||||
var message = MQTTDeviceMessage.Deserialize<TeltonikaMessageV2>(json, device, location);
|
||||
TeltonikaMessageV2? message = MQTTDeviceMessage.Deserialize<TeltonikaMessageV2>(json, device, location);
|
||||
Assert.IsNull(message);
|
||||
|
||||
json = "lufhy2q9478ry78aq39 f3g789fy egy 3ghuieg heasuhg egh eisulgh uielg hsalgire";
|
||||
@@ -324,6 +326,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
Assert.AreEqual(location, message.Location);
|
||||
|
||||
//Temp
|
||||
Assert.IsNotNull(message.GSM);
|
||||
Assert.AreEqual(380, message.GSM.Temperature);
|
||||
Assert.AreEqual(38.0, message.GSM.TempValue());
|
||||
Assert.AreEqual("38℃", message.GSM.TempString());
|
||||
@@ -333,6 +336,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
Assert.AreEqual("??℃", message.GSM.TempString());
|
||||
|
||||
//Uptime
|
||||
Assert.IsNotNull(message.Base);
|
||||
Assert.AreEqual((uint)1698233689, message.Base.Time);
|
||||
Assert.AreEqual("2023-10-25 13:34:49", message.Base.LocalTime);
|
||||
|
||||
@@ -341,7 +345,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
//Assert.AreEqual("1 days 3 hours 58 min 0 sec", message.Base.UptimeString(new DateTime(2023, 10, 9, 0, 0, 00)));
|
||||
|
||||
|
||||
|
||||
Assert.IsNotNull(message.Usage);
|
||||
//ThisMonthRX
|
||||
Assert.AreEqual((UInt64)30888399, message.Usage.Rx);
|
||||
//ThisMonthTX
|
||||
@@ -370,7 +374,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
string json = File.ReadAllText(myfile);
|
||||
Debug.WriteLine(json);
|
||||
|
||||
TeltonikaMessageV2 message = MQTTDeviceMessage.Deserialize<TeltonikaMessageV2>(json, device, location);
|
||||
TeltonikaMessageV2? message = MQTTDeviceMessage.Deserialize<TeltonikaMessageV2>(json, device, location);
|
||||
Assert.IsNotNull(message);
|
||||
Assert.IsInstanceOfType<TeltonikaMessageV2>(message);
|
||||
|
||||
@@ -378,6 +382,7 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
Assert.AreEqual(location, message.Location);
|
||||
|
||||
//Temp
|
||||
Assert.IsNotNull(message.GSM);
|
||||
Assert.AreEqual(470, message.GSM.Temperature);
|
||||
Assert.AreEqual(47.0, message.GSM.TempValue());
|
||||
Assert.AreEqual("47℃", message.GSM.TempString());
|
||||
@@ -387,10 +392,12 @@ namespace UCS_Status_Monitor.UnitTest
|
||||
Assert.AreEqual("??℃", message.GSM.TempString());
|
||||
|
||||
//Time
|
||||
Assert.IsNotNull(message.Base);
|
||||
Assert.AreEqual((uint)1748264319, message.Base.Time);
|
||||
Assert.AreEqual("2025-05-26 14:58:39", message.Base.LocalTime);
|
||||
|
||||
//Usage
|
||||
Assert.IsNotNull(message.Usage);
|
||||
Assert.AreEqual((UInt64)1450717947, message.Usage.Rx);
|
||||
Assert.AreEqual((UInt64)2629954194, message.Usage.Tx);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.10" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
||||
<PackageReference Include="Moq" Version="4.20.72" />
|
||||
<PackageReference Include="MQTTnet" Version="5.0.1.1416" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="4.0.1" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="4.0.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="4.0.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="4.0.2" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
private async Task UpdateTable()
|
||||
{
|
||||
using MonitorDbContext db = await _contextFactory.CreateDbContextAsync();
|
||||
system = await db.UCSSystems.Where(i => i.UCSSystemId == Id).Include(d => d.Devices).SingleOrDefaultAsync();
|
||||
system = await db.UCSSystems.Where(i => i.UCSSystemId == Id).Include(d => d.Devices).SingleOrDefaultAsync() ?? new UCSSystem();
|
||||
|
||||
system.Devices = system.Devices.SortTable(sortOrder).ToList();
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace UCS_Status_Monitor.Models.Database
|
||||
public DateTime LastMessageClient { get; set; }
|
||||
|
||||
[Display(Name = "UCS uptime")]
|
||||
public string Uptime { get; set; } = string.Empty;
|
||||
public string Uptime { get; set; } = string.Empty;
|
||||
|
||||
[Display(Name = "System uptime")]
|
||||
public string SystemUptime { get; set; } = string.Empty;
|
||||
@@ -160,8 +160,8 @@ namespace UCS_Status_Monitor.Models.Database
|
||||
|
||||
public ICollection<UCSDevice> Devices { get; set; } = [];
|
||||
|
||||
public ICollection<Logging> Loggings { get; set; } = [];
|
||||
public ICollection<Logging> Loggings { get; } = [];
|
||||
|
||||
public ICollection<EventLogError> Errors { get; set; } = [];
|
||||
public ICollection<EventLogError> Errors { get; } = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<UserSecretsId>2a38e861-2927-4c7f-97fa-7a31b346c61e</UserSecretsId>
|
||||
<Company>SDN Engineering</Company>
|
||||
<Product>UCS Status Monitor</Product>
|
||||
@@ -35,15 +35,15 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.10">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MQTTnet" Version="5.0.1.1416" />
|
||||
<PackageReference Include="MQTTnet.Extensions.ManagedClient" Version="4.3.7.1207" />
|
||||
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="9.0.10" />
|
||||
<PackageReference Include="System.Management" Version="9.0.10" />
|
||||
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="10.0.0" />
|
||||
<PackageReference Include="System.Management" Version="10.0.0" />
|
||||
<PackageReference Include="Telegram.Bot" Version="22.7.5" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user