62 lines
1.7 KiB
C#
62 lines
1.7 KiB
C#
using Salmon.Core;
|
|
using Salmon.Model.Monitor;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
namespace Salmon.Test;
|
|
|
|
[TestClass]
|
|
public class TestCore
|
|
{
|
|
Core.Instance Instance = new();
|
|
|
|
public TestCore()
|
|
{
|
|
Instance.Init().Wait();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestSetting()
|
|
{
|
|
string id = Guid.NewGuid().ToString();
|
|
Software soft = Software.FromLocal(id);
|
|
soft.ShortName = "tester";
|
|
soft.LongName = "Test Alpha 7 budokaï mk7";
|
|
soft.Description = "Tant de milliers d'hommes connaissent à peine, dans leur agitation obscure, leur propre coeur";
|
|
|
|
|
|
Instance.Set(soft);
|
|
|
|
var retrieved = Instance.RetrieveElement<Software>(id);
|
|
|
|
Assert.AreEqual(soft.UniqueId, retrieved.UniqueId);
|
|
Assert.AreEqual(soft.ParentId, retrieved.ParentId);
|
|
Assert.AreEqual(soft.ShortName, retrieved.ShortName);
|
|
Assert.AreEqual(soft.LongName, retrieved.LongName);
|
|
Assert.AreEqual(soft.Description, retrieved.Description);
|
|
|
|
Assert.AreEqual(soft.MachineName, retrieved.MachineName);
|
|
Assert.AreEqual(soft.Online, retrieved.Online);
|
|
Assert.AreEqual(soft.ExecutablePath, retrieved.ExecutablePath);
|
|
Assert.AreEqual(soft.ProcessId, retrieved.ProcessId);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void StressTest()
|
|
{
|
|
for(int i = 0; i < 1_000_000; i++)
|
|
{
|
|
string id = Guid.NewGuid().ToString();
|
|
|
|
Element e = new Element(id)
|
|
{
|
|
ShortName = "Instance " + id,
|
|
LongName = "Instance " + id + " (but longer)",
|
|
Description = "blah blah blah",
|
|
ParentId = "1-1-1-1"
|
|
};
|
|
|
|
Instance.Set(e);
|
|
}
|
|
}
|
|
}
|