mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 13:57:28 +02:00
Legacy testing lib added..
This commit is contained in:
parent
0167fc321f
commit
47ed05837e
118 changed files with 17505 additions and 0 deletions
|
@ -0,0 +1,110 @@
|
|||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue