sharee.bike-App/SharedBusinessLogic.Tests/ViewModel/Settings/TestPollingParameters.cs
2024-04-09 12:53:23 +02:00

40 lines
1.5 KiB
C#

using System;
using NUnit.Framework;
using ShareeBike.Settings;
namespace SharedBusinessLogic.Tests.Fixtures.ObjectTests.SettingsNS
{
[TestFixture]
public class TestPollingParameters
{
[Test]
public void TestConstruct()
{
Assert.That(new PollingParameters(new TimeSpan(0, 0, 11), true).IsActivated, Is.True);
Assert.That((new PollingParameters(new TimeSpan(0, 0, 11), true).Periode.TotalSeconds), Is.EqualTo(11));
}
[Test]
public void TestEquals()
{
Assert.That((new PollingParameters(new TimeSpan(0, 0, 11), true)) == (new PollingParameters(new TimeSpan(0, 0, 11), true)), Is.True);
Assert.That((new PollingParameters(new TimeSpan(0, 0, 11), false)) == (new PollingParameters(new TimeSpan(0, 0, 11), true)), Is.False);
Assert.That((new PollingParameters(new TimeSpan(0, 0, 12), true)) == (new PollingParameters(new TimeSpan(0, 0, 11), true)), Is.False);
}
[Test]
public void TestUnequals()
{
Assert.That((new PollingParameters(new TimeSpan(0, 0, 11), true)) != (new PollingParameters(new TimeSpan(0, 0, 11), true)), Is.False);
Assert.That((new PollingParameters(new TimeSpan(0, 0, 11), false)) != (new PollingParameters(new TimeSpan(0, 0, 11), true)), Is.True);
Assert.That((new PollingParameters(new TimeSpan(0, 0, 12), true)) != (new PollingParameters(new TimeSpan(0, 0, 11), true)), Is.True);
}
[Test]
public void TestToString()
{
Assert.That(
(new PollingParameters(new TimeSpan(0, 0, 11), true).ToString()), Is.EqualTo("Polling is on=True, polling interval=11[sec]."));
}
}
}