Exemple #1
0
        public void SequenceGeneratorByte__Should_work()
        {
            var generator = new SequenceGeneratorByte();

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

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

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

            generator = new SequenceGeneratorByte {
                From = Byte.MaxValue - 1
            };
            Assert.AreEqual((Byte)(Byte.MaxValue - 1), generator.GetValue());
            Assert.AreEqual((Byte)(Byte.MaxValue - 0), generator.GetValue());
            Assert.AreEqual((Byte)(Byte.MinValue + 0), generator.GetValue());
            Assert.AreEqual((Byte)(Byte.MinValue + 1), generator.GetValue());
        }
        public void SequenceGeneratorByte__Should_work()
        {
            var generator = new SequenceGeneratorByte();
            Assert.Equal((Byte)0, generator.GetValue());
            Assert.Equal((Byte)1, generator.GetValue());
            Assert.Equal((Byte)2, generator.GetValue());

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

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

            generator = new SequenceGeneratorByte { From = Byte.MaxValue - 1 };
            Assert.Equal((Byte)(Byte.MaxValue - 1), generator.GetValue());
            Assert.Equal((Byte)(Byte.MaxValue - 0), generator.GetValue());
            Assert.Equal((Byte)(Byte.MinValue + 0), generator.GetValue());
            Assert.Equal((Byte)(Byte.MinValue + 1), generator.GetValue());
        }