public static void AtomicDoubleTest() { double i = 10D; Equal(11D, i.IncrementAndGet()); Equal(10D, i.DecrementAndGet()); i = 20D; True(i.CompareAndSet(20D, 30D)); Equal(30D, i); False(i.CompareAndSet(20D, 50D)); Equal(30D, i); Equal(80D, i.Add(50D)); Equal(80D, i); Equal(80D, i.GetAndAccumulate(10D, (x, y) => x + y)); Equal(90D, i); Equal(10D, i.AccumulateAndGet(80D, (x, y) => x - y)); Equal(10D, i); Equal(10D, i.GetAndSet(25D)); Equal(25D, i); Equal(42D, i.UpdateAndGet(current => 42D)); Equal(42D, i.GetAndUpdate(current => 52D)); Equal(52D, i); }