mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-06-23 15:16:33 +02:00
163 lines
7.8 KiB
C#
163 lines
7.8 KiB
C#
using NUnit.Framework;
|
|
using System.Collections.Generic;
|
|
using TINK.Model;
|
|
|
|
using TINK.ViewModel.Map;
|
|
namespace UITest.Fixtures.ObjectTests.ViewModel.Map
|
|
{
|
|
|
|
[TestFixture]
|
|
public class TestMapPageViewModel
|
|
{
|
|
/// <summary>
|
|
/// Verifies that if Konrad is turned off in settings map page filter does no more contain Konrad option.
|
|
/// </summary>
|
|
[Test]
|
|
public void TestGetFilterDictinaryMapPage_NoKonrad_TinkOnKonradOff()
|
|
{
|
|
var l_oDict = GroupFilterMapPageHelper.CreateUpdated(
|
|
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }), // Last map page filter (Konrad was still available but off)
|
|
new List<string> { "TINK" }); // Filters from settings page.
|
|
|
|
Assert.AreEqual(1, l_oDict.Count);
|
|
Assert.IsTrue(l_oDict.ContainsKey("TINK"));
|
|
Assert.AreEqual(FilterState.On, l_oDict["TINK"]);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifies that if Konrad is turned off in settings map page filter does no more contain Konrad option.
|
|
/// </summary>
|
|
[Test]
|
|
public void TestGetFilterDictinaryMapPage_NoKonrad_TinkOffKonradOn()
|
|
{
|
|
var l_oDict = GroupFilterMapPageHelper.CreateUpdated(
|
|
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.Off }, { "Konrad", FilterState.On } }), // Last map page filter (Konrad was still available but off)
|
|
new List<string> { "TINK" }); // Filters from settings page.
|
|
|
|
Assert.AreEqual(1, l_oDict.Count);
|
|
Assert.IsTrue(l_oDict.ContainsKey("TINK"));
|
|
Assert.AreEqual(FilterState.On, l_oDict["TINK"]);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifies that if TINK.* is turned off in settings map page filter does no more contain TINK option.
|
|
/// </summary>
|
|
[Test]
|
|
public void TestGetFilterDictinaryMapPage_NoTink_TinkOnKonradOff()
|
|
{
|
|
var l_oDict = GroupFilterMapPageHelper.CreateUpdated(
|
|
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }), // Last map page filter (Konrad was still available but off)
|
|
new List<string> { "Konrad" }); // Filters from settings page.
|
|
|
|
Assert.AreEqual(1, l_oDict.Count);
|
|
Assert.IsTrue(l_oDict.ContainsKey("Konrad"));
|
|
Assert.AreEqual(FilterState.On, l_oDict["Konrad"]);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifies that if Konrad is turned on in settings map page filter is updated with entry Konrad.
|
|
/// </summary>
|
|
[Test]
|
|
public void TestGetFilterDictinaryMapPage_TinkOn()
|
|
{
|
|
var l_oDict = GroupFilterMapPageHelper.CreateUpdated(
|
|
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On } }), // Last map page filter (Konrad was still available but off)
|
|
new List<string> { "TINK", "Konrad" }); // Filters from settings page.
|
|
|
|
Assert.AreEqual(2, l_oDict.Count);
|
|
Assert.IsTrue(l_oDict.ContainsKey("TINK"));
|
|
Assert.AreEqual(FilterState.Off, l_oDict["TINK"]);
|
|
Assert.IsTrue(l_oDict.ContainsKey("Konrad"));
|
|
Assert.AreEqual(FilterState.On, l_oDict["Konrad"]);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifies that if Konrad is turned on in settings map page filter is updated with entry Konrad.
|
|
/// </summary>
|
|
[Test]
|
|
public void TestGetFilterDictinaryMapPage_TinkOff()
|
|
{
|
|
var l_oDict = GroupFilterMapPageHelper.CreateUpdated(
|
|
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.Off } }), // Last map page filter (Konrad was still available but off)
|
|
new List<string> { "TINK", "Konrad" }); // Filters from settings page.
|
|
|
|
Assert.AreEqual(2, l_oDict.Count);
|
|
Assert.IsTrue(l_oDict.ContainsKey("TINK"));
|
|
Assert.AreEqual(FilterState.Off, l_oDict["TINK"]);
|
|
Assert.IsTrue(l_oDict.ContainsKey("Konrad"));
|
|
Assert.AreEqual(FilterState.On, l_oDict["Konrad"]);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifies that map page filters are not touched if state is consitend.
|
|
/// </summary>
|
|
[Test]
|
|
public void TestGetFilterDictinaryMapPage_AllOn_KonradActivated()
|
|
{
|
|
var l_oDict = GroupFilterMapPageHelper.CreateUpdated(
|
|
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.Off }, { "Konrad", FilterState.On } }), // Last map page filter (Konrad was still available but off)
|
|
new List<string> { "TINK", "Konrad" }); // Filters from settings page.
|
|
|
|
Assert.AreEqual(2, l_oDict.Count);
|
|
Assert.IsTrue(l_oDict.ContainsKey("TINK"));
|
|
Assert.AreEqual(FilterState.Off, l_oDict["TINK"]);
|
|
Assert.IsTrue(l_oDict.ContainsKey("Konrad"));
|
|
Assert.AreEqual(FilterState.On, l_oDict["Konrad"]);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifies that map page filters are not touched if state is consitend..
|
|
/// </summary>
|
|
[Test]
|
|
public void TestGetFilterDictinaryMapPage_AllOn_TinkActivated()
|
|
{
|
|
var l_oDict = GroupFilterMapPageHelper.CreateUpdated(
|
|
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }), // Last map page filter (Konrad was still available but off)
|
|
new List<string> { "TINK", "Konrad" }); // Filters from settings page.
|
|
|
|
Assert.AreEqual(2, l_oDict.Count);
|
|
Assert.IsTrue(l_oDict.ContainsKey("TINK"));
|
|
Assert.AreEqual(FilterState.On, l_oDict["TINK"]);
|
|
Assert.IsTrue(l_oDict.ContainsKey("Konrad"));
|
|
Assert.AreEqual(FilterState.Off, l_oDict["Konrad"]);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifies that map page filters are not touched if state is consitend.
|
|
/// </summary>
|
|
[Test]
|
|
public void TestGetFilterDictinaryMapPage_NullFilter()
|
|
{
|
|
var l_oDict = GroupFilterMapPageHelper.CreateUpdated(
|
|
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }), // Last map page filter (Konrad was still available but off)
|
|
null);
|
|
|
|
Assert.AreEqual(2, l_oDict.Count, "Do not apply any filter if filter value null is detected.");
|
|
Assert.IsTrue(l_oDict.ContainsKey("TINK"));
|
|
Assert.AreEqual(FilterState.On, l_oDict["TINK"]);
|
|
Assert.IsTrue(l_oDict.ContainsKey("Konrad"));
|
|
Assert.AreEqual(FilterState.Off, l_oDict["Konrad"]);
|
|
|
|
l_oDict = GroupFilterMapPageHelper.CreateUpdated(
|
|
null,
|
|
null);
|
|
|
|
Assert.IsNull(l_oDict, "Do not apply any filter if filter value null is detected.");
|
|
}
|
|
|
|
[Test]
|
|
public void TestDoToggle()
|
|
{
|
|
var l_oFilter = new TinkKonradToggleViewModel(new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }));
|
|
|
|
l_oFilter = new TinkKonradToggleViewModel(l_oFilter.FilterDictionary). DoToggle();
|
|
|
|
Assert.AreEqual("Konrad", l_oFilter.CurrentFilter);
|
|
|
|
l_oFilter = new TinkKonradToggleViewModel(l_oFilter.FilterDictionary).DoToggle();
|
|
|
|
Assert.AreEqual("TINK", l_oFilter.CurrentFilter);
|
|
}
|
|
}
|
|
}
|