Esempio n. 1
0
        public void testIsRegisteredInDatabase()
        {
            LINQDatabase mockDatabase = mocks.Stub <LINQDatabase>();

            User zarakavaUse = new User();

            zarakavaUse.setName("Zarakava");
            zarakavaUse.setPass("Testing");

            using (mocks.Record())
            {
                mockDatabase.getUser("Zarakava");
                LastCall.Return(zarakavaUse);
                mockDatabase.getUser("NULLMAN");
                LastCall.Return(null);
            }

            UserRegistration.setDatabase(mockDatabase);
            Assert.IsTrue(UserRegistration.isRegistered("Zarakava"));
            Assert.IsFalse(UserRegistration.isRegistered("NULLMAN"));
        }
Esempio n. 2
0
        public static bool isRegistered(string name)
        {
            User checker = database.getUser(name);

            return(checker != null);
        }