示例#1
0
        public async Task Sync_Records_If_Missing()
        {
            av = new ApplicationValidation(nuContext.Object);

            moqApps.SetupData();
            var count = await moqApps.Object.CountAsync();

            Assert.IsTrue(count == 0);

            Array.ForEach(defaultApps.ToArray(), a => {
                moqApps.Object.Add(a);
            });

            Assert.AreEqual(moqApps.Object.Count(), defaultApps.Count);
        }
示例#2
0
        private static void CheckInputs(string token, string cvv, string registrationDateTime)
        {
            ApplicationValidation.When(string.IsNullOrWhiteSpace(token))
            .OrWhen(token != null && Regex.Matches(token, @"[a-zA-Z]").Count > 0)
            .ThenThrows("Invalid token");

            ApplicationValidation.When(string.IsNullOrWhiteSpace(cvv))
            .OrWhen(cvv != null && cvv.Length > 5)
            .OrWhen(cvv != null && Regex.Matches(cvv, @"[a-zA-Z]").Count > 0)
            .ThenThrows("Invalid cvv");

            try
            {
                Convert.ToDateTime(registrationDateTime);
            }
            catch (Exception)
            {
                throw new ApplicationException("Invalid date registration");
            }
        }
示例#3
0
 public void ApplicationValidationTestInitialize()
 {
     av          = new ApplicationValidation();
     defaultApps = av.DefaultApps;
 }