public void SequenceGeneratorInt16__Should_work()
        {
            var generator = new SequenceGeneratorInt16();
            Assert.Equal((Int16)0, generator.GetValue());
            Assert.Equal((Int16)1, generator.GetValue());
            Assert.Equal((Int16)2, generator.GetValue());

            generator = new SequenceGeneratorInt16 { From = 3 };
            Assert.Equal((Int16)3, generator.GetValue());
            Assert.Equal((Int16)4, generator.GetValue());
            Assert.Equal((Int16)5, generator.GetValue());

            generator = new SequenceGeneratorInt16 { From = 3, Step = 3 };
            Assert.Equal((Int16)3, generator.GetValue());
            Assert.Equal((Int16)6, generator.GetValue());
            Assert.Equal((Int16)9, generator.GetValue());

            generator = new SequenceGeneratorInt16 { From = 3, Step = -3 };
            Assert.Equal((Int16)3, generator.GetValue());
            Assert.Equal((Int16)0, generator.GetValue());
            Assert.Equal((Int16)(-3), generator.GetValue());

            generator = new SequenceGeneratorInt16 { From = Int16.MaxValue - 1 };
            Assert.Equal((Int16)(Int16.MaxValue - 1), generator.GetValue());
            Assert.Equal((Int16)(Int16.MaxValue - 0), generator.GetValue());
            Assert.Equal((Int16)(Int16.MinValue + 0), generator.GetValue());
            Assert.Equal((Int16)(Int16.MinValue + 1), generator.GetValue());
        }
Esempio n. 2
0
        public void SequenceGeneratorInt16__Should_work()
        {
            var generator = new SequenceGeneratorInt16();

            Assert.AreEqual((Int16)0, generator.GetValue());
            Assert.AreEqual((Int16)1, generator.GetValue());
            Assert.AreEqual((Int16)2, generator.GetValue());

            generator = new SequenceGeneratorInt16 {
                From = 3
            };
            Assert.AreEqual((Int16)3, generator.GetValue());
            Assert.AreEqual((Int16)4, generator.GetValue());
            Assert.AreEqual((Int16)5, generator.GetValue());

            generator = new SequenceGeneratorInt16 {
                From = 3, Step = 3
            };
            Assert.AreEqual((Int16)3, generator.GetValue());
            Assert.AreEqual((Int16)6, generator.GetValue());
            Assert.AreEqual((Int16)9, generator.GetValue());

            generator = new SequenceGeneratorInt16 {
                From = 3, Step = -3
            };
            Assert.AreEqual((Int16)3, generator.GetValue());
            Assert.AreEqual((Int16)0, generator.GetValue());
            Assert.AreEqual((Int16)(-3), generator.GetValue());

            generator = new SequenceGeneratorInt16 {
                From = Int16.MaxValue - 1
            };
            Assert.AreEqual((Int16)(Int16.MaxValue - 1), generator.GetValue());
            Assert.AreEqual((Int16)(Int16.MaxValue - 0), generator.GetValue());
            Assert.AreEqual((Int16)(Int16.MinValue + 0), generator.GetValue());
            Assert.AreEqual((Int16)(Int16.MinValue + 1), generator.GetValue());
        }