Beispiel #1
0
        public void AtomicBoolean_Store_Should_Fail()
        {
            var atomicBoolean = new AtomicBoolean(true);

            Assert.Throws <InvalidOperationException>(() => atomicBoolean.Store(false, MemoryOrder.Acquire));
            Assert.Throws <NotSupportedException>(() => atomicBoolean.Store(false, MemoryOrder.Consume));
        }
Beispiel #2
0
        public void AtomicBoolean_Store_Should_Success(bool initialValue, bool storeValue, MemoryOrder order)
        {
            var atomicBoolean = new AtomicBoolean(initialValue, MemoryOrder.Relaxed);

            atomicBoolean.Store(storeValue, order);
            Assert.Equal(storeValue, atomicBoolean.Value);
        }
 public void AtomicBoolean_Store_Should_Fail()
 {
     var atomicBoolean = new AtomicBoolean(true);
     Assert.Throws<InvalidOperationException>(() => atomicBoolean.Store(false, MemoryOrder.Acquire));
     Assert.Throws<NotSupportedException>(() => atomicBoolean.Store(false, MemoryOrder.Consume));
 }
 public void AtomicBoolean_Store_Should_Success(bool initialValue, bool storeValue, MemoryOrder order)
 {
     var atomicBoolean = new AtomicBoolean(initialValue, order);
     atomicBoolean.Store(storeValue, order);
     Assert.Equal(storeValue, atomicBoolean.Value);
 }