예제 #1
0
 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();
     }
 }
예제 #2
0
 public void UsernameProperty()
 {
     UserCommand userCommand = new UserCommand();
     userCommand.Username = "******";
     Assert.AreEqual("Xpto", userCommand.Username);
 }
예제 #3
0
 public void UsernameCantBeNull()
 {
     UserCommand userCommand = new UserCommand();
     try
     {
         userCommand.Username = null;
         Assert.Fail();
     }
     catch(ArgumentNullException exception)
     {
         Assert.AreEqual("Username", exception.ParamName);
     }
     catch
     {
         Assert.Fail();
     }
 }
예제 #4
0
 public void UserHostServerCantStartWithColon()
 {
     UserCommand userCommand = new UserCommand();
     try
     {
         userCommand.Username = "******";
         userCommand.Servername = ":CantStartWithColon";
         userCommand.Hostname = ":CantStartWithColon";
         Assert.Fail();
     }
     catch(ArgumentException)
     {
     }
     catch
     {
         Assert.Fail();
     }
 }
예제 #5
0
 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();
     }
 }
예제 #6
0
 public void ServernameCantBeEmpty()
 {
     UserCommand userCommand = new UserCommand();
     try
     {
         userCommand.Servername = "";
         Assert.Fail();
     }
     catch(ArgumentException exception)
     {
         Assert.AreEqual("Servername", exception.ParamName);
     }
     catch
     {
         Assert.Fail();
     }
 }