Beispiel #1
0
        public void Cas_should_process()
        {
            // Arrange
            int a = 5;

            // Act
            AtomicUtils.DoWithCas(ref a, v => v * 15);

            // Assert
            Assert.Equal(75, a);
        }
Beispiel #2
0
        public void Atomic_swap_should_swap_values()
        {
            // Arrange
            int a = 2, b = 5;

            // Act
            AtomicUtils.Swap(ref a, ref b);

            // Assert
            Assert.Equal(5, a);
            Assert.Equal(2, b);
        }