public void Test_TrySetFalse_already_falsy() { var boolean = new AtomicBoolean(); boolean.TrySetFalse().Should().BeFalse(); ((bool)boolean).Should().BeFalse(); }
public void Test_TrySetFalse_truly() { var boolean = new AtomicBoolean(); boolean.TrySetTrue(); boolean.TrySetFalse().Should().BeTrue(); ((bool)boolean).Should().BeFalse(); }
/// <inheritdoc /> public void Stop() { lock (startStopSync) { if (isRunning.TrySetFalse()) { log.Info("Stopped. Unregistering.."); stopCancellationToken.Cancel(); checkNodeSignal.Set(); beaconTask.GetAwaiter().GetResult(); stopCancellationToken.Dispose(); if (!DeleteNodeAsync().GetAwaiter().GetResult()) { Task.Run(DeleteNodeTask); } } } }
public void TrySetFalse_should_return_true_if_value_was_true() { boolean.Value = true; boolean.TrySetFalse().Should().BeTrue(); }