コード例 #1
0
ファイル: PinTest.cs プロジェクト: Masternz/Pins
        public void ValidateThatPinLenghtCreatesTheCorrectRandomSize(int pinLength, int expectedResult)
        {
            IValidation val = new Validation();

            // Assemble
            IPinsValidation iValidation = new PinsLibrary(val);
            // Execute

            var result = iValidation.GetRandomInputSizeBasedOnPinLength(pinLength);

            // Assert

            Assert.Equal(expectedResult, result);
            // do some more stuff
        }
コード例 #2
0
ファイル: PinTest.cs プロジェクト: Masternz/Pins
        public void ValidateTheValidationClass()
        {
            const int expectedValue = 1;

            IValidation val = new Validation();

            IPinsLibrary lib = new PinsLibrary(val);

            IValidator validation = new ValidateConsecutive();

            // Add a validator
            lib.Validation.Add(validation);

            // get the validation object back and do a count on it.

            int validatorCount = lib.Validation.Validators.Count;

            // we should have a validator count of 1
            Assert.Equal(validatorCount, expectedValue);
        }
コード例 #3
0
ファイル: PinTest.cs プロジェクト: Masternz/Pins
        //[ExpectedException(typeof(NotImplementedException))]
        public void GenerateBatch_WithCorrectCountAndPinWith_CorrectBatchZizeAndLenght()
        {
            const int width     = 4;
            const int batchSize = 1000;

            IValidation val = new Validation();

            IPinsLibrary lib = new PinsLibrary(val);

            lib.Validation.Add(new ValidateConsecutive());
            lib.Validation.Add(new ValidateSequential());

            var x = lib.GenerateBatch(batchSize, width);


            Assert.True(x.Count == batchSize);
            foreach (string pin in x)
            {
                Assert.True(pin.Length == width);
            }
        }