public Server() { var temp = Search.database = new LINQDatabase(); UserRegistration.setDatabase(temp); Search.database = temp; }
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 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)); }