예제 #1
0
        public void Create_should_throw_when_increment_is_out_of_range(int increment)
        {
            var exception = Record.Exception(() => ObjectIdReflector.Create(1, 1, increment));
            var e         = exception.Should().BeOfType <ArgumentOutOfRangeException>().Subject;

            e.ParamName.Should().Be("increment");
        }
예제 #2
0
        public void Create_should_throw_when_random_is_out_of_range(long random)
        {
            var exception = Record.Exception(() => ObjectIdReflector.Create(1, random, 1));
            var e         = exception.Should().BeOfType <ArgumentOutOfRangeException>().Subject;

            e.ParamName.Should().Be("random");
        }
예제 #3
0
        public void Create_should_generate_expected_a_b_c(uint timestamp, long random, uint increment, uint expectedA, uint expectedB, uint expectedC)
        {
            var objectId = ObjectIdReflector.Create((int)timestamp, random, (int)increment);

            objectId._a().Should().Be((int)expectedA);
            objectId._b().Should().Be((int)expectedB);
            objectId._c().Should().Be((int)expectedC);
        }
예제 #4
0
        public void Ensure_that_increment_wraps_around_after_max_value(int seedIncrement, int expectedIncrement)
        {
            ObjectIdReflector.__staticIncrement(seedIncrement);
            var objectId = ObjectId.GenerateNewId();

#pragma warning disable 618
            objectId.Increment.Should().Be(expectedIncrement);
#pragma warning restore 618
        }
예제 #5
0
 public void Create_should_not_throw_when_arguments_are_valid(long random, int increment)
 {
     var _ = ObjectIdReflector.Create(1, random, increment);
 }