Ejemplo n.º 1
0
        private static void UserVerification()
        {
            Console.WriteLine("Enter your username:"******"This user is approved");
            }
            else
            {
                Console.WriteLine("Wrong user. Try again!");
                UserVerification();
            }
        }
Ejemplo n.º 2
0
        protected void OnCompareTargetChanged()
        {
            if (this.CompareTarget != CompareTarget.Id)
            {
                return;
            }

            if (IdentityChecker == null)
            {
                throw new NotSupportedException("No IdentityChecker assigned, cannot perform Id check");
            }

            if (!IdentityChecker.SupportsId(this.Info.PropertyType))
            {
                throw new NotSupportedException(string.Format("Property {0}: type ({1}) must support Id check", this.Info.Name, this.Info.PropertyType));
            }
        }
Ejemplo n.º 3
0
        protected static void CheckId(object expected, object candidate, string objectName)
        {
            // If both null we are ok, and can't check the Id property so quit now.
            if (CheckNullNotNull(expected, candidate, objectName))
            {
                return;
            }

            if (IdentityChecker == null)
            {
                throw new NotSupportedException("No IdentityChecker assigned, cannot perform Id check");
            }

            var expectedId  = IdentityChecker.ExtractId(expected);
            var candidateId = IdentityChecker.ExtractId(candidate);

            if (!Equals(expectedId, candidateId))
            {
                throw new PropertyCheckException(objectName, expectedId, candidateId);
            }
        }
Ejemplo n.º 4
0
 public void IdentityChecker_Returns_False_If_Invalid_Name_Is_Entered()
 {
     Assert.False(IdentityChecker.TestIfStarWarsActor(PeopleFetcher.GetListOfPeople(), "Dork Waiter"));
 }
Ejemplo n.º 5
0
 public void IdentityChecker_Returns_True_If_Valid_Name_Is_Entered()
 {
     Assert.True(IdentityChecker.TestIfStarWarsActor(PeopleFetcher.GetListOfPeople(), "Darth Vader"));
 }