public void TestTramOnRail()
 {
     Rail rail = new Rail(1, true, false, 1, "Combino");
     User user = new User(2323, "test", "test", 1);
     Tram tram = new Tram(1, "test", rail, user, 1, false);
     tram.OnRail = true;
     Assert.AreEqual(true, tram.OnRail, "Tram on rail");
 }
Beispiel #2
0
 /// <summary>
 /// Creation of a new tram
 /// </summary>
 /// <param name="id">id of the tram</param>
 /// <param name="type">tram type</param>
 /// <param name="rail">rail on which the tram should be placed on</param>
 /// <param name="driver">the driver of the tram</param>
 /// <param name="status">1= OK 2= Dirty 3= Defect 4= DirtyAndDefect</param>
 public Tram(int id, string type, Rail rail, User driver, int status, bool onRail)
 {
     this.Id = id;
     this.Type = type;
     this.Rail = rail;
     this.Driver = driver;
     Status = (Status)status;
     OnRail = onRail;
 }
 public void TestMoveTram()
 {
     Rail rail = new Rail(1, true, false, 1, "Combino");
     Rail rail2 = new Rail(2, true, false, 1, "Combino");
     User user = new User(2323, "test", "test", 1);
     Tram tram = new Tram(1, "test", rail, user, 1, true);/*
     tram.AddTram(1, 1, 1, 1);
     tram.MoveTram(2, 1, 1);
     Assert.AreEqual(2, rail2.Id, "rail 2");*/
     Assert.AreEqual(1,1);
 }
 public void TestTramProperties()
 {
     Rail rail = new Rail(1, true, false, 1, "Combino");
     User user = new User(2323, "test", "test", 1);
     Tram tram = new Tram(1, "test", rail, user, 1, true);
     Assert.AreEqual(tram.Id, 1, "TramID");
     Assert.AreEqual(tram.Type, "test", "tramID");
     Assert.AreEqual(tram.Rail, rail, "tram rail");
     Assert.AreEqual(tram.Driver, user, "tram driver");
     Assert.AreEqual(tram.OnRail, true, "tram onrail");
     Assert.AreEqual(tram._Status, 1, "tram status");
 }
 /// <summary>
 /// logs the user in
 /// </summary>
 /// <param name="username">username of the user</param>
 /// <param name="password">matching password</param>
 /// <returns>bool indicating succes</returns>
 public bool LogIn(string username, string password)
 {
     foreach (Dictionary<string, object> D in addatabase.Getuserpassword(username))
     {
         if ((string)D["wachtwoord"] == password)
         {
             LoggedInUser = new User(Convert.ToInt32(D["gebruikerid"]), (string)D["naam"], (string)D["email"], Convert.ToInt32(D["functieid"]));
             return true;
         }
     }
     return false;
 }