Files
MeadeGeneric/Meade.net.UnitTests/ThreadSafeBoolTests.cs
T
Sebastian Godelet 6fc476b031 Make further properties multi-client and thread-safe
Move MovingPrimary, MovingSecondary, EarliestNonSlewingTime to
SharedResources, make all new properties thread-safe (atomic)
operations.
2021-06-22 17:21:21 +10:00

40 lines
889 B
C#

using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeBoolTests
{
[TestCase(false)]
[TestCase(true)]
public void WhenConvertedValueIsSame(bool value)
{
// given
ThreadSafeBool sut = value;
// when
bool actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(false, false)]
[TestCase(false, true)]
[TestCase(true, false)]
[TestCase(true, true)]
public void WhenSetValueIsChanged(bool value, bool setValue)
{
// given
ThreadSafeBool sut = value;
// when
sut.Set(setValue);
bool afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}