public void nameAcceptTest() { User newUser = new User(); newUser.setName("TestName"); Assert.AreEqual("TestName", newUser.getName()); }
public CaesuraMain() { client = new Client.Client(); server = new Server.Server(); serverThread = new Thread(new ThreadStart(server.run)); DatabaseInterface mockDatabase = mocks.Stub<DatabaseInterface>(); 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); serverThread.Start(); System.Threading.Thread.Sleep(5000); }
public CaesuraMain() { client = new Client.Client(); server = new Server.Server(); serverThread = new Thread(new ThreadStart(server.run)); DatabaseInterface mockDatabase = mocks.Stub <DatabaseInterface>(); 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); serverThread.Start(); System.Threading.Thread.Sleep(5000); }
public bool login(string userName, string pass) { if (currentUser == null) { if (UserRegistration.login(userName, pass)) { currentUser = new User(); currentUser.setName(userName); currentUser.setPass(pass); return(true); } return(false); } throw new InvalidOperationException("Already Logged in"); }
public void testIsRegisteredInDatabase() { DatabaseInterface mockDatabase = mocks.Stub<DatabaseInterface>(); 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 testIsRegisteredInDatabase() { DatabaseInterface mockDatabase = mocks.Stub <DatabaseInterface>(); 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() { DatabaseInterface mockDatabase = mocks.Stub <DatabaseInterface>(); 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)); }
public bool login(string userName, string pass) { if (currentUser == null) { if (UserRegistration.login(userName, pass)) { currentUser = new User(); currentUser.setName(userName); currentUser.setPass(pass); return true; } return false; } throw new InvalidOperationException("Already Logged in"); }
public void nullNameTest() { User newUser = new User(); newUser.setName(null); }
public void nameAcceptTest() { User newUser = new User(); newUser.setName("TestName"); Assert.AreEqual("TestName", newUser.getName()); }
public void testRegisteredInDatabase() { DatabaseInterface mockDatabase = mocks.Stub<DatabaseInterface>(); 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)); }
public void nullNameTest() { User newUser = new User(); newUser.setName(null); }