mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 05:47:28 +02:00
Version 3.0.338
This commit is contained in:
parent
573fe77e12
commit
0468955d49
751 changed files with 62747 additions and 60672 deletions
|
@ -8,169 +8,169 @@ using TINK.Settings;
|
|||
|
||||
namespace TestTINKLib.Model.Settings
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestJsonSettingsDictionary
|
||||
{
|
||||
/// <summary> Verifies that empty log fiel leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetCopriHostUri_NoFile()
|
||||
{
|
||||
Assert.IsNull(JsonSettingsDictionary.GetCopriHostUri(new Dictionary<string, string>()));
|
||||
}
|
||||
[TestFixture]
|
||||
public class TestJsonSettingsDictionary
|
||||
{
|
||||
/// <summary> Verifies that empty log fiel leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetCopriHostUri_NoFile()
|
||||
{
|
||||
Assert.IsNull(JsonSettingsDictionary.GetCopriHostUri(new Dictionary<string, string>()));
|
||||
}
|
||||
|
||||
/// <summary> Verifies that empty log file leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetPolling()
|
||||
{
|
||||
// Serialize parameters.
|
||||
var l_oDict = new Dictionary<string, string>()
|
||||
.SetPollingParameters(new PollingParameters(new TimeSpan(0, 0, 0, 15, 0), false));
|
||||
/// <summary> Verifies that empty log file leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetPolling()
|
||||
{
|
||||
// Serialize parameters.
|
||||
var l_oDict = new Dictionary<string, string>()
|
||||
.SetPollingParameters(new PollingParameters(new TimeSpan(0, 0, 0, 15, 0), false));
|
||||
|
||||
// Deserialize parameters.
|
||||
Assert.AreEqual(
|
||||
new PollingParameters(new TimeSpan(0, 0, 0, 15, 0), false),
|
||||
l_oDict.GetPollingParameters());
|
||||
}
|
||||
// Deserialize parameters.
|
||||
Assert.AreEqual(
|
||||
new PollingParameters(new TimeSpan(0, 0, 0, 15, 0), false),
|
||||
l_oDict.GetPollingParameters());
|
||||
}
|
||||
|
||||
/// <summary> Verifies that empty log fiel leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetPolling_NoFile()
|
||||
{
|
||||
Assert.IsNull(JsonSettingsDictionary.GetPollingParameters(new Dictionary<string, string>()));
|
||||
}
|
||||
/// <summary> Verifies that empty log fiel leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetPolling_NoFile()
|
||||
{
|
||||
Assert.IsNull(JsonSettingsDictionary.GetPollingParameters(new Dictionary<string, string>()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetGetCopriHostUri()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>()
|
||||
.SetCopriHostUri("http://1.2.3.4");
|
||||
Assert.AreEqual(
|
||||
new Uri("http://1.2.3.4"),
|
||||
JsonSettingsDictionary.GetCopriHostUri(l_oDict));
|
||||
}
|
||||
[Test]
|
||||
public void TestGetGetCopriHostUri()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>()
|
||||
.SetCopriHostUri("http://1.2.3.4");
|
||||
Assert.AreEqual(
|
||||
new Uri("http://1.2.3.4"),
|
||||
JsonSettingsDictionary.GetCopriHostUri(l_oDict));
|
||||
}
|
||||
|
||||
/// <summary> Verifies that empty log fiel leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetLoggingLevel()
|
||||
{
|
||||
var l_oDictionary = new Dictionary<string, string>()
|
||||
.SetMinimumLoggingLevel(0); // Verbose = 0
|
||||
Assert.AreEqual(
|
||||
LogEventLevel.Verbose,
|
||||
JsonSettingsDictionary.GetMinimumLoggingLevel(l_oDictionary)); // LogEventLevel.Error = 4
|
||||
}
|
||||
/// <summary> Verifies that empty log fiel leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetLoggingLevel()
|
||||
{
|
||||
var l_oDictionary = new Dictionary<string, string>()
|
||||
.SetMinimumLoggingLevel(0); // Verbose = 0
|
||||
Assert.AreEqual(
|
||||
LogEventLevel.Verbose,
|
||||
JsonSettingsDictionary.GetMinimumLoggingLevel(l_oDictionary)); // LogEventLevel.Error = 4
|
||||
}
|
||||
|
||||
/// <summary> Verifies that empty log fiel leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetLoggingLevel_NoFile()
|
||||
{
|
||||
Assert.IsNull(JsonSettingsDictionary.GetMinimumLoggingLevel(new Dictionary<string, string>()));
|
||||
}
|
||||
/// <summary> Verifies that empty log fiel leads to expected default value and doesn not throw exceptions.</summary>
|
||||
[Test]
|
||||
public void TestGetLoggingLevel_NoFile()
|
||||
{
|
||||
Assert.IsNull(JsonSettingsDictionary.GetMinimumLoggingLevel(new Dictionary<string, string>()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetAppVersion_FirstInstall()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>();
|
||||
Assert.IsNull(JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
}
|
||||
[Test]
|
||||
public void TestGetAppVersion_FirstInstall()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>();
|
||||
Assert.IsNull(JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetAppVersion_LegacyTo115()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string> { { "AppVersion", "7.2.3.9" } };
|
||||
Assert.AreEqual(new Version(7, 2, 3, 9), JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
[Test]
|
||||
public void TestGetAppVersion_LegacyTo115()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string> { { "AppVersion", "7.2.3.9" } };
|
||||
Assert.AreEqual(new Version(7, 2, 3, 9), JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
|
||||
l_oDict = new Dictionary<string, string> { { "AppVersion", "7.2.3" } };
|
||||
Assert.AreEqual(new Version(7, 2, 3), JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
}
|
||||
l_oDict = new Dictionary<string, string> { { "AppVersion", "7.2.3" } };
|
||||
Assert.AreEqual(new Version(7, 2, 3), JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetAppVersion_Json()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string> { { "AppVersion", "\"3.1.2.117\"" } };
|
||||
Assert.AreEqual(new Version(3, 1, 2, 117), JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
}
|
||||
[Test]
|
||||
public void TestGetAppVersion_Json()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string> { { "AppVersion", "\"3.1.2.117\"" } };
|
||||
Assert.AreEqual(new Version(3, 1, 2, 117), JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetAppVersion_Json()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>()
|
||||
.SetAppVersion(new Version(47, 12, 3));
|
||||
Assert.AreEqual(new Version(47, 12, 3), JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
}
|
||||
[Test]
|
||||
public void TestSetAppVersion_Json()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>()
|
||||
.SetAppVersion(new Version(47, 12, 3));
|
||||
Assert.AreEqual(new Version(47, 12, 3), JsonSettingsDictionary.GetAppVersion(l_oDict));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetShowWhatsNew_FirstInstall()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>();
|
||||
Assert.IsNull(JsonSettingsDictionary.GetWhatsNew(l_oDict));
|
||||
}
|
||||
[Test]
|
||||
public void TestGetShowWhatsNew_FirstInstall()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>();
|
||||
Assert.IsNull(JsonSettingsDictionary.GetWhatsNew(l_oDict));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetShowWhatsNew_Json()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string> { { "ShowWhatsNew", "\"3.1.2.117\"" } };
|
||||
Assert.AreEqual(new Version(3, 1, 2, 117), JsonSettingsDictionary.GetWhatsNew(l_oDict));
|
||||
[Test]
|
||||
public void TestGetShowWhatsNew_Json()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string> { { "ShowWhatsNew", "\"3.1.2.117\"" } };
|
||||
Assert.AreEqual(new Version(3, 1, 2, 117), JsonSettingsDictionary.GetWhatsNew(l_oDict));
|
||||
|
||||
l_oDict = new Dictionary<string, string> { { "ShowWhatsNew", "\"3.1.2\"" } };
|
||||
Assert.AreEqual(new Version(3, 1, 2), JsonSettingsDictionary.GetWhatsNew(l_oDict));
|
||||
}
|
||||
l_oDict = new Dictionary<string, string> { { "ShowWhatsNew", "\"3.1.2\"" } };
|
||||
Assert.AreEqual(new Version(3, 1, 2), JsonSettingsDictionary.GetWhatsNew(l_oDict));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetShowWhats_Json()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>()
|
||||
.SetWhatsNew(new Version(47, 12, 3));
|
||||
Assert.AreEqual(new Version(47, 12, 3), JsonSettingsDictionary.GetWhatsNew(l_oDict));
|
||||
}
|
||||
[Test]
|
||||
public void TestSetShowWhats_Json()
|
||||
{
|
||||
var l_oDict = new Dictionary<string, string>()
|
||||
.SetWhatsNew(new Version(47, 12, 3));
|
||||
Assert.AreEqual(new Version(47, 12, 3), JsonSettingsDictionary.GetWhatsNew(l_oDict));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetEntryTNoLegacySettingsKeyNull() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>(null, new Dictionary<string, string>()),
|
||||
Is.Null);
|
||||
[Test]
|
||||
public void TestGetEntryTNoLegacySettingsKeyNull() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>(null, new Dictionary<string, string>()),
|
||||
Is.Null);
|
||||
|
||||
[Test]
|
||||
public void TestGetEntryTNoLegacySettingsNull() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>("Hi", null),
|
||||
Is.Null);
|
||||
[Test]
|
||||
public void TestGetEntryTNoLegacySettingsNull() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>("Hi", null),
|
||||
Is.Null);
|
||||
|
||||
[Test]
|
||||
public void TestGetEntryTNoLegacyEntryNotFound() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>("Hi", new Dictionary<string, string> { { "Ho", @"""Hu""" } }),
|
||||
Is.Null);
|
||||
[Test]
|
||||
public void TestGetEntryTNoLegacyEntryNotFound() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>("Hi", new Dictionary<string, string> { { "Ho", @"""Hu""" } }),
|
||||
Is.Null);
|
||||
|
||||
[Test]
|
||||
public void TestGetEntryTNoLegacyEntryFound() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>("Hi", new Dictionary<string, string> { { "Hi", @"""Ho""" } }),
|
||||
Is.EqualTo("Ho"));
|
||||
[Test]
|
||||
public void TestGetEntryTNoLegacyEntryFound() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>("Hi", new Dictionary<string, string> { { "Hi", @"""Ho""" } }),
|
||||
Is.EqualTo("Ho"));
|
||||
|
||||
[Test]
|
||||
public void TestGetEntryT() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>("Hi", new Dictionary<string, string> { { "Hi", @"""Ho""" } }, (value) => @"""Hey"""),
|
||||
Is.EqualTo("Hey"));
|
||||
[Test]
|
||||
public void TestGetEntryT() => Assert.That(
|
||||
JsonSettingsDictionary.GetEntry<string>("Hi", new Dictionary<string, string> { { "Hi", @"""Ho""" } }, (value) => @"""Hey"""),
|
||||
Is.EqualTo("Hey"));
|
||||
|
||||
[Test]
|
||||
public void TestGetActiveTheme() => Assert.That(
|
||||
JsonSettingsDictionary.GetActiveTheme(new Dictionary<string, string> { { "Theme", @"""Konrad""" } }),
|
||||
Is.EqualTo(typeof(TINK.Themes.Konrad).Name));
|
||||
[Test]
|
||||
public void TestGetActiveTheme() => Assert.That(
|
||||
JsonSettingsDictionary.GetActiveTheme(new Dictionary<string, string> { { "Theme", @"""Konrad""" } }),
|
||||
Is.EqualTo(typeof(TINK.Themes.Konrad).Name));
|
||||
|
||||
[Test]
|
||||
public void TestGetActiveThemeLegacy() => Assert.That(
|
||||
JsonSettingsDictionary.GetActiveTheme(new Dictionary<string, string> { { "Theme", @"""TINK.Themes.Konrad""" } }),
|
||||
Is.EqualTo(typeof(TINK.Themes.Konrad).Name));
|
||||
[Test]
|
||||
public void TestGetActiveThemeLegacy() => Assert.That(
|
||||
JsonSettingsDictionary.GetActiveTheme(new Dictionary<string, string> { { "Theme", @"""TINK.Themes.Konrad""" } }),
|
||||
Is.EqualTo(typeof(TINK.Themes.Konrad).Name));
|
||||
|
||||
[Test]
|
||||
public void TestSetActiveTheme()
|
||||
{
|
||||
var settings = JsonSettingsDictionary.SetActiveTheme(new Dictionary<string, string>(), @"Konrad");
|
||||
Assert.That(
|
||||
settings,
|
||||
Contains.Key("Theme"));
|
||||
[Test]
|
||||
public void TestSetActiveTheme()
|
||||
{
|
||||
var settings = JsonSettingsDictionary.SetActiveTheme(new Dictionary<string, string>(), @"Konrad");
|
||||
Assert.That(
|
||||
settings,
|
||||
Contains.Key("Theme"));
|
||||
|
||||
settings = JsonSettingsDictionary.SetActiveTheme(new Dictionary<string, string>(), @"Konrad");
|
||||
Assert.That(
|
||||
settings["Theme"],
|
||||
Is.EqualTo(JsonConvert.SerializeObject(typeof(TINK.Themes.Konrad).Name)));
|
||||
}
|
||||
}
|
||||
settings = JsonSettingsDictionary.SetActiveTheme(new Dictionary<string, string>(), @"Konrad");
|
||||
Assert.That(
|
||||
settings["Theme"],
|
||||
Is.EqualTo(JsonConvert.SerializeObject(typeof(TINK.Themes.Konrad).Name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue