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")); }
public static bool isRegistered(string name) { User checker = database.getUser(name); return(checker != null); }