Exemple #1
0
        public void ItCanRevalidateDetailsOnImmediateRepeat()
        {
            var checker = new ModulusChecker();

            Assert.IsTrue(checker.CheckBankAccount(Sortcode, AccNumber));
            Assert.IsTrue(checker.CheckBankAccount(Sortcode, AccNumber));
        }
Exemple #2
0
        public void ItCanRevalidateDetailsOnSeparatedRepeat(string sc, string an)
        {
            var checker = new ModulusChecker();

            Assert.IsTrue(checker.CheckBankAccount(Sortcode, AccNumber), string.Format("first check should have passed for {0} and {1}", Sortcode, AccNumber));
            Assert.IsTrue(checker.CheckBankAccount(sc, an), string.Format("separating check should have passed for {0} and {1}", sc, an));
            Assert.IsTrue(checker.CheckBankAccount(Sortcode, AccNumber), string.Format("second check should have passed for {0} and {1}", Sortcode, AccNumber));
        }
        public void ItCanProcessALargeFileInUnder(int seconds)
        {
            var stopwatch      = new Stopwatch();
            var modulusChecker = new ModulusChecker();

            var currentDirectory = TestContext.CurrentContext.TestDirectory;
            var fileName         = "sa.txt";
            var fullPath         = Path.Combine(currentDirectory, fileName);

            using (var sr = new StreamReader(fullPath))
            {
                stopwatch.Start();

                while (sr.Peek() >= 0)
                {
                    var segments = sr
                                   .ReadLine()
                                   .Split('\t');

                    modulusChecker.CheckBankAccount(segments.First(), segments.Last());
                }

                stopwatch.Stop();
            }

            Assert.IsTrue(stopwatch.Elapsed.Seconds <= seconds,
                          $"Failed to process a large number of sortcodes and account numbers in under {seconds} seconds. Took {stopwatch.Elapsed.Seconds}");
        }
Exemple #4
0
        public void CanPassCurrentVocalinkTestCases(string sc, string an, bool expectedResult)
        {
            Assert.AreEqual(expectedResult, _modulusChecker.CheckBankAccount(sc, an));

            var outcomeWithExplanation = _modulusChecker.CheckBankAccountWithExplanation(sc, an);

            Assert.AreEqual(expectedResult, outcomeWithExplanation.Result);

            Console.WriteLine(outcomeWithExplanation.Explanation);
            Assert.IsNotEmpty(outcomeWithExplanation.Explanation);
        }
        public void ItCanProcessALargeFileInUnder(int seconds)
        {
            var stopwatch      = new Stopwatch();
            var modulusChecker = new ModulusChecker();

            using (var sr = new StreamReader("sa.txt"))
            {
                stopwatch.Start();

                while (sr.Peek() >= 0)
                {
                    var segments = sr
                                   .ReadLine()
                                   .Split('\t');

                    modulusChecker.CheckBankAccount(segments.First(), segments.Last());
                }

                stopwatch.Stop();
            }

            Assert.IsTrue(stopwatch.Elapsed.Seconds <= seconds, string.Format("Failed to process a large number of sortcodes and account numbers in under {0} seconds.", seconds));
        }
Exemple #6
0
        public void SeparatingCheckPassesInIsolation(string sc, string an)
        {
            var checker = new ModulusChecker();

            Assert.IsTrue(checker.CheckBankAccount(Sortcode, AccNumber));
        }
Exemple #7
0
 public void CanPassCurrentVocalinkTestCases(string sc, string an, bool expectedResult)
 {
     Assert.AreEqual(expectedResult, _modulusChecker.CheckBankAccount(sc, an));
 }