示例#1
0
        public Server()
        {
            var temp = Search.database = new LINQDatabase();

            UserRegistration.setDatabase(temp);
            Search.database = temp;
        }
示例#2
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"));
        }
示例#3
0
        public void testRegisteredInDatabase()
        {
            LINQDatabase mockDatabase = mocks.Stub <LINQDatabase>();

            User zarakavaUse = new User();

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

            using (mocks.Record())
            {
                // The mock will return "Whale Rider" when the call is made with 24
                //mockDatabase.registerUser(zarakavaUse);
                //LastCall.Return(true);
                // mockDatabase.registerUser(null);
                // LastCall.Return(false);
            }

            UserRegistration.setDatabase(mockDatabase);
            Assert.IsTrue(UserRegistration.register(zarakavaUse));
            Assert.IsFalse(UserRegistration.register(null));
        }