public void GenerateTest()
        {
            var c      = new LuhnModNConfig();
            var g      = new LuhnModNGenerator(c);
            var result = g.Next(6);
            var v      = new LuhnModNValidator(c);

            Assert.True(v.Validate(result));
        }
Beispiel #2
0
        public void GenerateTest()
        {
            var c      = new LuhnModNConfig();
            var r      = new Random(123); //Sub in a crypto method if desired.
            var g      = new LuhnModNGenerator(c);
            var result = g.Next(x => r.Next(x));
            var v      = new LuhnModNValidator(c);

            Assert.IsTrue(v.Validate(result));
        }
        public void LuhnModNGenerator_Generates_Valid_Key()
        {
            //Arrange
            var charSet   = "BCFGJLQRSTUVXYZ23456789";
            var keyLength = 7;

            var generator = new LuhnModNGenerator(new LuhnModNConfig(charSet, keyLength));
            // Act
            var key = generator.Next(7);

            // Assert
            var validator = new LuhnModNValidator(new LuhnModNConfig(charSet, keyLength));

            Assert.True(validator.Validate(key));
        }