Exemplo n.º 1
0
 public void TryChange_with_two_parameters(int startingValue, int fromValue, int toValue, int expectedValue, bool expectedResult)
 {
     var subject = new InterlockedInt32(startingValue);
     var result = subject.TryChange(fromValue, toValue);
     subject.Value.Should().Be(expectedValue);
     result.Should().Be(expectedResult);
 }
Exemplo n.º 2
0
 public void TryChange_with_one_parameter(int initialValue, int toValue, int expectedValue, bool expectedResult)
 {
     var subject = new InterlockedInt32(initialValue);
     var result = subject.TryChange(toValue);
     subject.Value.Should().Be(expectedValue);
     result.Should().Be(expectedResult);
 }
Exemplo n.º 3
0
        public void TryChange_with_two_parameters_should_throw_if_values_are_equal()
        {
            var    subject = new InterlockedInt32(0);
            Action action  = () => subject.TryChange(1, 1);

            action.ShouldThrow <ArgumentException>();
        }
Exemplo n.º 4
0
        public void TryChange_with_two_parameters(int startingValue, int fromValue, int toValue, int expectedValue, bool expectedResult)
        {
            var subject = new InterlockedInt32(startingValue);
            var result  = subject.TryChange(fromValue, toValue);

            subject.Value.Should().Be(expectedValue);
            result.Should().Be(expectedResult);
        }
Exemplo n.º 5
0
        public void TryChange_with_one_parameter(int initialValue, int toValue, int expectedValue, bool expectedResult)
        {
            var subject = new InterlockedInt32(initialValue);
            var result  = subject.TryChange(toValue);

            subject.Value.Should().Be(expectedValue);
            result.Should().Be(expectedResult);
        }
Exemplo n.º 6
0
 public void TryChange_with_two_parameters_should_throw_if_values_are_equal()
 {
     var subject = new InterlockedInt32(0);
     Action action = () => subject.TryChange(1, 1);
     action.ShouldThrow<ArgumentException>();
 }