public void MessageWithoutHostname() { UserCommand userCommand = new UserCommand(); userCommand.Username = "******"; try { String message = userCommand.Message; Assert.Fail(); } catch(InvalidOperationException exception) { Assert.AreEqual("You must set Hostname.", exception.Message); } catch { Assert.Fail(); } }
public void UsernameProperty() { UserCommand userCommand = new UserCommand(); userCommand.Username = "******"; Assert.AreEqual("Xpto", userCommand.Username); }
public void UsernameCantBeNull() { UserCommand userCommand = new UserCommand(); try { userCommand.Username = null; Assert.Fail(); } catch(ArgumentNullException exception) { Assert.AreEqual("Username", exception.ParamName); } catch { Assert.Fail(); } }
public void UserHostServerCantStartWithColon() { UserCommand userCommand = new UserCommand(); try { userCommand.Username = "******"; userCommand.Servername = ":CantStartWithColon"; userCommand.Hostname = ":CantStartWithColon"; Assert.Fail(); } catch(ArgumentException) { } catch { Assert.Fail(); } }
public void UserHostServerCantHaveSpaces() { UserCommand userCommand = new UserCommand(); try { userCommand.Username = "******"; userCommand.Servername = "Can't have spaces"; userCommand.Hostname = "Can't have spaces"; Assert.Fail(); } catch(ArgumentException) { } catch { Assert.Fail(); } }
public void ServernameCantBeEmpty() { UserCommand userCommand = new UserCommand(); try { userCommand.Servername = ""; Assert.Fail(); } catch(ArgumentException exception) { Assert.AreEqual("Servername", exception.ParamName); } catch { Assert.Fail(); } }