Пример #1
0
        public void AtomicInteger_Store_Should_Fail()
        {
            var atomicInteger = new AtomicInteger(int.MaxValue);

            Assert.Throws <InvalidOperationException>(() => atomicInteger.Store(int.MinValue, MemoryOrder.Acquire));
            Assert.Throws <NotSupportedException>(() => atomicInteger.Store(int.MinValue, MemoryOrder.Consume));
        }
Пример #2
0
        public void AtomicInteger_Store_Should_Success(int initialValue, int storeValue, MemoryOrder order)
        {
            var atomicInteger = new AtomicInteger(initialValue, MemoryOrder.Relaxed);

            atomicInteger.Store(storeValue, order);
            Assert.Equal(storeValue, atomicInteger.Value);
        }
 public void AtomicInteger_Store_Should_Fail()
 {
     var atomicInteger = new AtomicInteger(int.MaxValue);
     Assert.Throws<InvalidOperationException>(() => atomicInteger.Store(int.MinValue, MemoryOrder.Acquire));
     Assert.Throws<NotSupportedException>(() => atomicInteger.Store(int.MinValue, MemoryOrder.Consume));
 }
 public void AtomicInteger_Store_Should_Success(int initialValue, int storeValue, MemoryOrder order)
 {
     var atomicInteger = new AtomicInteger(initialValue, order);
     atomicInteger.Store(storeValue, order);
     Assert.Equal(storeValue, atomicInteger.Value);
 }