mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-20 03:56:29 +02:00
Version 3.0.361
This commit is contained in:
parent
faf68061f4
commit
cba4da9357
88 changed files with 1119 additions and 1502 deletions
110
TestShareeLib/ViewModel/Settings/TestFilterCollectionMutable.cs
Normal file
110
TestShareeLib/ViewModel/Settings/TestFilterCollectionMutable.cs
Normal file
|
@ -0,0 +1,110 @@
|
|||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
using TINK.ViewModel.Settings;
|
||||
|
||||
|
||||
namespace UITest.Fixtures.ObjectTests.ViewModel.Settings
|
||||
{
|
||||
|
||||
[TestFixture]
|
||||
public class TestFilterCollectionMutable
|
||||
{
|
||||
[Test]
|
||||
public void TestConstruct_NoConradAccount()
|
||||
{
|
||||
var l_oColl = new SettingsBikeFilterViewModel(
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> {
|
||||
{"TINK", FilterState.On },
|
||||
{"Konrad", FilterState.On}
|
||||
}),
|
||||
new List<string> { "TINK" });
|
||||
|
||||
Assert.AreEqual("TINK", l_oColl[0].Key);
|
||||
Assert.IsTrue(l_oColl[0].IsActivated);
|
||||
Assert.IsTrue(l_oColl[0].IsEnabled);
|
||||
|
||||
Assert.AreEqual("Konrad", l_oColl[1].Key);
|
||||
Assert.IsFalse(l_oColl[1].IsActivated, "Konrad must be off if user is not part of group.");
|
||||
Assert.IsFalse(l_oColl[1].IsEnabled, "Konrad must be disabled if user is not part of group.");
|
||||
|
||||
Assert.AreEqual(FilterState.On, l_oColl.FilterCollection["TINK"]);
|
||||
Assert.AreEqual(FilterState.On, l_oColl.FilterCollection["Konrad"], "Filter state must be preserved.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstruct_ConradAccount()
|
||||
{
|
||||
var l_oColl = new SettingsBikeFilterViewModel(
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> {
|
||||
{"TINK", FilterState.On },
|
||||
{"Konrad", FilterState.On}
|
||||
}),
|
||||
new List<string> { "TINK", "Konrad" });
|
||||
|
||||
Assert.AreEqual("TINK", l_oColl[0].Key);
|
||||
Assert.IsTrue(l_oColl[0].IsActivated);
|
||||
Assert.IsTrue(l_oColl[0].IsEnabled);
|
||||
|
||||
Assert.AreEqual("Konrad", l_oColl[1].Key);
|
||||
Assert.IsTrue(l_oColl[1].IsActivated);
|
||||
Assert.IsTrue(l_oColl[1].IsEnabled);
|
||||
|
||||
Assert.AreEqual(FilterState.On, l_oColl.FilterCollection["TINK"]);
|
||||
Assert.AreEqual(FilterState.On, l_oColl.FilterCollection["Konrad"], "Filter state must be preserved.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstruct_TurnOff()
|
||||
{
|
||||
var l_oColl = new SettingsBikeFilterViewModel(
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> {
|
||||
{"TINK", FilterState.On },
|
||||
{"Konrad", FilterState.On}
|
||||
}),
|
||||
new List<string> { "TINK", "Konrad" });
|
||||
|
||||
// Check prerequisites.
|
||||
Assert.AreEqual("TINK", l_oColl[0].Key);
|
||||
Assert.IsTrue(l_oColl[0].IsActivated);
|
||||
Assert.IsTrue(l_oColl[0].IsEnabled);
|
||||
|
||||
Assert.AreEqual("Konrad", l_oColl[1].Key);
|
||||
Assert.IsTrue(l_oColl[1].IsActivated);
|
||||
Assert.IsTrue(l_oColl[1].IsEnabled);
|
||||
|
||||
Assert.AreEqual(FilterState.On, l_oColl.FilterCollection["TINK"]);
|
||||
Assert.AreEqual(FilterState.On, l_oColl.FilterCollection["Konrad"], "Filter state must be preserved.");
|
||||
|
||||
// Turn filter konrad off.
|
||||
l_oColl[1].IsActivated = false;
|
||||
|
||||
// Verify changes.
|
||||
Assert.AreEqual(FilterState.On, l_oColl.FilterCollection["TINK"]);
|
||||
Assert.AreEqual(FilterState.Off, l_oColl.FilterCollection["Konrad"], "Filter state must be preserved.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstruct_NoUserLoggedIn()
|
||||
{
|
||||
var l_oColl = new SettingsBikeFilterViewModel(
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> {
|
||||
{"TINK", FilterState.On },
|
||||
{"Konrad", FilterState.On}
|
||||
}),
|
||||
null);
|
||||
|
||||
// Check prerequisites.
|
||||
Assert.AreEqual("TINK", l_oColl[0].Key);
|
||||
Assert.IsTrue(l_oColl[0].IsActivated);
|
||||
Assert.IsTrue(l_oColl[0].IsEnabled);
|
||||
|
||||
Assert.AreEqual("Konrad", l_oColl[1].Key);
|
||||
Assert.IsTrue(l_oColl[1].IsActivated);
|
||||
Assert.IsTrue(l_oColl[1].IsEnabled);
|
||||
|
||||
Assert.AreEqual(FilterState.On, l_oColl.FilterCollection["TINK"]);
|
||||
Assert.AreEqual(FilterState.On, l_oColl.FilterCollection["Konrad"], "Filter state must be preserved.");
|
||||
}
|
||||
}
|
||||
}
|
24
TestShareeLib/ViewModel/Settings/TestGroupFilterSettings.cs
Normal file
24
TestShareeLib/ViewModel/Settings/TestGroupFilterSettings.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.ViewModel.Settings;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.SettingsNS
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestGroupFilterSettings
|
||||
{
|
||||
[Test]
|
||||
public void TestDoFilter()
|
||||
{
|
||||
var l_oFilter = new GroupFilterSettings(new Dictionary<string, FilterState> { { $"HOM_{FilterHelper.CITYBIKE}", FilterState.Off }, { $"HOM_{FilterHelper.CARGOBIKE}", FilterState.On }, { "HOM_117025", FilterState.On } });
|
||||
|
||||
var l_oResult = l_oFilter.DoFilter(new List<string> { $"HOM_{FilterHelper.CITYBIKE}", $"HOM_{FilterHelper.CARGOBIKE}" });
|
||||
|
||||
Assert.AreEqual(1, l_oResult.ToList().Count);
|
||||
Assert.AreEqual($"HOM_{FilterHelper.CARGOBIKE}", l_oResult.ToList()[0]);
|
||||
}
|
||||
}
|
||||
}
|
41
TestShareeLib/ViewModel/Settings/TestPollingParameters.cs
Normal file
41
TestShareeLib/ViewModel/Settings/TestPollingParameters.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
using TINK.Settings;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.SettingsNS
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestPollingParameters
|
||||
{
|
||||
[Test]
|
||||
public void TestConstruct()
|
||||
{
|
||||
Assert.IsTrue(new PollingParameters(new TimeSpan(0, 0, 11), true).IsActivated);
|
||||
Assert.AreEqual(11, (new PollingParameters(new TimeSpan(0, 0, 11), true).Periode.TotalSeconds));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEquals()
|
||||
{
|
||||
Assert.IsTrue((new PollingParameters(new TimeSpan(0, 0, 11), true)) == (new PollingParameters(new TimeSpan(0, 0, 11), true)));
|
||||
Assert.IsFalse((new PollingParameters(new TimeSpan(0, 0, 11), false)) == (new PollingParameters(new TimeSpan(0, 0, 11), true)));
|
||||
Assert.IsFalse((new PollingParameters(new TimeSpan(0, 0, 12), true)) == (new PollingParameters(new TimeSpan(0, 0, 11), true)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUnequals()
|
||||
{
|
||||
Assert.IsFalse((new PollingParameters(new TimeSpan(0, 0, 11), true)) != (new PollingParameters(new TimeSpan(0, 0, 11), true)));
|
||||
Assert.IsTrue((new PollingParameters(new TimeSpan(0, 0, 11), false)) != (new PollingParameters(new TimeSpan(0, 0, 11), true)));
|
||||
Assert.IsTrue((new PollingParameters(new TimeSpan(0, 0, 12), true)) != (new PollingParameters(new TimeSpan(0, 0, 11), true)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestToString()
|
||||
{
|
||||
Assert.AreEqual(
|
||||
"Polling is on=True, polling interval=11[sec].",
|
||||
(new PollingParameters(new TimeSpan(0, 0, 11), true).ToString()));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue